| Classes | Job Modules | Data Objects | Services | Algorithms | Tools | Packages | Directories | Tracs |

In This Package:

IToolSvc.h

Go to the documentation of this file.
00001 #ifndef GAUDIKERNEL_ITOOLSVC_H
00002 #define GAUDIKERNEL_ITOOLSVC_H
00003 
00004 #include "GaudiKernel/IInterface.h"
00005 #include "GaudiKernel/System.h"
00006 #include <string>
00007 
00008 // Forward declaration
00009 class IAlgTool;
00010 // Declaration of the interface ID 
00011 // ( interface id, major version, minor version) 
00012 static const InterfaceID IID_IToolSvc("IToolSvc", 2 , 0); 
00013 
00020 class IToolSvc : virtual public IInterface {
00021   public:
00022 
00024   static const InterfaceID& interfaceID() { return IID_IToolSvc; }
00025 
00037   virtual StatusCode retrieve ( const std::string& type            ,
00038                                 const InterfaceID& iid             , 
00039                                 IAlgTool*&         tool            ,
00040                                 const IInterface*  parent   = 0    ,
00041                                 bool               createIf = true ) = 0;
00042 
00055   virtual StatusCode retrieve ( const std::string& type            ,
00056                                 const std::string& name            ,
00057                                 const InterfaceID& iid             , 
00058                                 IAlgTool*&         tool            ,
00059                                 const IInterface*  parent   = 0    ,
00060                                 bool               createIf = true ) = 0 ;
00061   
00065   virtual std::vector<std::string> getInstances( const std::string& toolType ) = 0;
00066 
00070   virtual StatusCode releaseTool( IAlgTool* tool ) = 0;
00071   
00072   
00136   template <class T>
00137   StatusCode retrieveTool ( const std::string& type            , 
00138                             T*&                tool            , 
00139                             const IInterface*  parent   = 0    , 
00140                             bool               createIf = true ) 
00141   {
00142     return retrieve( type, 
00143                      T::interfaceID(),
00144                      (IAlgTool*&)tool,
00145                      parent,
00146                      createIf );
00147   }
00148   
00192   template <class T>
00193   StatusCode retrieveTool ( const std::string& type            , 
00194                             const std::string& name            , 
00195                             T*&                tool            , 
00196                             const IInterface*  parent   = 0    , 
00197                             bool               createIf = true ) 
00198   {
00199     return retrieve ( type, 
00200                       name,
00201                       T::interfaceID(),
00202                       (IAlgTool*&)tool,
00203                       parent,
00204                       createIf );
00205   }
00206 
00236   class Observer {
00237   public:
00238     virtual ~Observer() {}
00239     virtual void onCreate(const IAlgTool*) {}
00240     virtual void onRetrieve(const IAlgTool*) {}
00241   };
00242 
00243   virtual void registerObserver(Observer *obs) = 0;
00244   virtual void unRegisterObserver(Observer *obs) = 0;
00245 
00246 
00247 };
00248 
00249 
00250 #endif // GAUDIKERNEL_ITOOLSVC_H
| Classes | Job Modules | Data Objects | Services | Algorithms | Tools | Packages | Directories | Tracs |

Generated on Mon Apr 11 19:56:57 2011 for GaudiKernel by doxygen 1.4.7