| # Gaudi Framework, version v20r3
Generated: 24 Nov 2008

# 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 Service, virtual public IToolSvc {
    00024
    00025 public:
    00026
    00027   // Typedefs
    00028   typedef std::list<IAlgTool*>     ListTools;
    00029
    00031   virtual StatusCode initialize();
    00032
    00034   virtual StatusCode finalize();
    00035
    00037   virtual StatusCode queryInterface( const InterfaceID& riid, void** ppvInterface );
    00038
    00040   virtual StatusCode retrieve(const std::string& type, const InterfaceID& iid,
    00041                               IAlgTool*& tool, const IInterface* parent,
    00042                               bool createIf);
    00043
    00045   virtual StatusCode retrieve(const std::string& tooltype, const std::string& toolname,
    00046                               const InterfaceID& iid, IAlgTool*& tool,
    00047                               const IInterface* parent, bool createIf);
    00048
    00050   virtual std::vector<std::string> getInstances( const std::string& toolType );
    00051
    00053   virtual StatusCode releaseTool( IAlgTool* tool );
    00054
    00056   StatusCode create(const std::string& type, const IInterface* parent,
    00057                             IAlgTool*& tool);
    00058
    00060   StatusCode create(const std::string& type, const std::string& name,
    00061                             const IInterface* parent, IAlgTool*& tool);
    00062
    00064   bool existsTool( const std::string& toolname) const;
    00065
    00067   std::string nameTool(const std::string& nameByUser, const IInterface* parent);
    00068
    00070   unsigned long refCountTool( IAlgTool* tool ) const { return tool->refCount(); }
    00071
    00076   ToolSvc( const std::string& name, ISvcLocator* svc );
    00077
    00079   virtual ~ToolSvc();
    00080
    00081   virtual void registerObserver(IToolSvc::Observer *obs) ;
    00082   virtual void unRegisterObserver(IToolSvc::Observer *obs) ;
    00083
    00084
    00085 private: // methods
    00086
    00087   // helper functions
    00088   //
    00090   unsigned long totalToolRefCount() const;
    00092   unsigned long totalToolRefCount( const ListTools& ) const;
    00094   unsigned long minimumToolRefCount() const;
    00095
    00097   StatusCode finalizeTool( IAlgTool* itool ) const;
    00098
    00099 private: // data
    00100
    00102   ListTools    m_instancesTools;        // List of all instances of tools
    00103
    00105   IHistorySvc* m_pHistorySvc;
    00106
    00107   std::vector<IToolSvc::Observer*> m_observers;
    00108 };
    00109
    00110 #endif
    00111
    00112