| # Gaudi Framework, version v22r0 |

Home |  | Generated: 9 Feb 2011

# ToolSvc.h

Go to the documentation of this file.

    00001 // $Id: ToolSvc.h,v 1.12 2008/06/02 14:21:35 marcocle Exp $
    00002 #ifndef GAUDISVC_TOOLSVC_H
    00003 #define GAUDISVC_TOOLSVC_H
    00004
    00005 // Include Files
    00006 #include "GaudiKernel/Service.h"
    00007 #include "GaudiKernel/IToolSvc.h"
    00008 #include <vector>
    00009
    00023 class ToolSvc : public extends1<Service, IToolSvc> {
    00024
    00025 public:
    00026
    00027   // Typedefs
    00028   typedef std::list<IAlgTool*>     ListTools;
    00029
    00031   virtual StatusCode initialize();
    00032
    00034   virtual StatusCode finalize();
    00035
    00036   // Start transition for tools
    00037   virtual StatusCode start();
    00038
    00039   // Stop transition for tools
    00040   virtual StatusCode stop();
    00041
    00043   virtual StatusCode retrieve(const std::string& type, const InterfaceID& iid,
    00044                               IAlgTool*& tool, const IInterface* parent,
    00045                               bool createIf);
    00046
    00048   virtual StatusCode retrieve(const std::string& tooltype, const std::string& toolname,
    00049                               const InterfaceID& iid, IAlgTool*& tool,
    00050                               const IInterface* parent, bool createIf);
    00051
    00053   virtual std::vector<std::string> getInstances( const std::string& toolType );
    00054
    00056   virtual StatusCode releaseTool( IAlgTool* tool );
    00057
    00059   StatusCode create(const std::string& type, const IInterface* parent,
    00060                             IAlgTool*& tool);
    00061
    00063   StatusCode create(const std::string& type, const std::string& name,
    00064                             const IInterface* parent, IAlgTool*& tool);
    00065
    00067   bool existsTool( const std::string& toolname) const;
    00068
    00070   std::string nameTool(const std::string& nameByUser, const IInterface* parent);
    00071
    00073   unsigned long refCountTool( IAlgTool* tool ) const { return tool->refCount(); }
    00074
    00079   ToolSvc( const std::string& name, ISvcLocator* svc );
    00080
    00082   virtual ~ToolSvc();
    00083
    00084   virtual void registerObserver(IToolSvc::Observer *obs) ;
    00085   virtual void unRegisterObserver(IToolSvc::Observer *obs) ;
    00086
    00087
    00088 private: // methods
    00089
    00090   // helper functions
    00091   //
    00093   unsigned long totalToolRefCount() const;
    00095   unsigned long totalToolRefCount( const ListTools& ) const;
    00097   unsigned long minimumToolRefCount() const;
    00098
    00100   StatusCode finalizeTool( IAlgTool* itool ) const;
    00101
    00102 private: // data
    00103
    00105   ListTools    m_instancesTools;        // List of all instances of tools
    00106
    00108   IHistorySvc* m_pHistorySvc;
    00109
    00110   std::vector<IToolSvc::Observer*> m_observers;
    00111 };
    00112
    00113 #endif
    00114
    00115

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Defines