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
00009 class IAlgTool;
00010
00017 class GAUDI_API IToolSvc: virtual public IInterface {
00018 public:
00020 DeclareInterfaceID(IToolSvc,2,0);
00021
00033 virtual StatusCode retrieve ( const std::string& type ,
00034 const InterfaceID& iid ,
00035 IAlgTool*& tool ,
00036 const IInterface* parent = 0 ,
00037 bool createIf = true ) = 0;
00038
00051 virtual StatusCode retrieve ( const std::string& type ,
00052 const std::string& name ,
00053 const InterfaceID& iid ,
00054 IAlgTool*& tool ,
00055 const IInterface* parent = 0 ,
00056 bool createIf = true ) = 0 ;
00057
00061 virtual std::vector<std::string> getInstances( const std::string& toolType ) = 0;
00062
00066 virtual StatusCode releaseTool( IAlgTool* tool ) = 0;
00067
00068
00132 template <class T>
00133 StatusCode retrieveTool ( const std::string& type ,
00134 T*& tool ,
00135 const IInterface* parent = 0 ,
00136 bool createIf = true )
00137 {
00138 return retrieve( type,
00139 T::interfaceID(),
00140 (IAlgTool*&)tool,
00141 parent,
00142 createIf );
00143 }
00144
00188 template <class T>
00189 StatusCode retrieveTool ( const std::string& type ,
00190 const std::string& name ,
00191 T*& tool ,
00192 const IInterface* parent = 0 ,
00193 bool createIf = true )
00194 {
00195 return retrieve ( type,
00196 name,
00197 T::interfaceID(),
00198 (IAlgTool*&)tool,
00199 parent,
00200 createIf );
00201 }
00202
00232 class Observer {
00233 public:
00234 virtual ~Observer() {}
00235 virtual void onCreate(const IAlgTool*) {}
00236 virtual void onRetrieve(const IAlgTool*) {}
00237 };
00238
00239 virtual void registerObserver(Observer *obs) = 0;
00240 virtual void unRegisterObserver(Observer *obs) = 0;
00241
00242
00243 };
00244
00245
00246 #endif // GAUDIKERNEL_ITOOLSVC_H