IToolSvc.h
Go to the documentation of this file.
1 #ifndef GAUDIKERNEL_ITOOLSVC_H
2 #define GAUDIKERNEL_ITOOLSVC_H
3 
4 #include "GaudiKernel/IInterface.h"
5 #include "GaudiKernel/System.h"
6 #include <string>
7 
8 // Forward declaration
9 class IAlgTool;
10 
17 class GAUDI_API IToolSvc: virtual public IInterface {
18 public:
21 
33  virtual StatusCode retrieve ( const std::string& type ,
34  const InterfaceID& iid ,
35  IAlgTool*& tool ,
36  const IInterface* parent = 0 ,
37  bool createIf = true ) = 0;
38 
51  virtual StatusCode retrieve ( const std::string& type ,
52  const std::string& name ,
53  const InterfaceID& iid ,
54  IAlgTool*& tool ,
55  const IInterface* parent = 0 ,
56  bool createIf = true ) = 0 ;
57 
61  virtual std::vector<std::string> getInstances( const std::string& toolType ) = 0;
62 
65  virtual std::vector<std::string> getInstances() const = 0;
66 
69  virtual std::vector<IAlgTool*> getTools() const = 0;
70 
74  virtual StatusCode releaseTool( IAlgTool* tool ) = 0;
75 
76 
140  template <class T>
141  StatusCode retrieveTool ( const std::string& type ,
142  T*& tool ,
143  const IInterface* parent = 0 ,
144  bool createIf = true )
145  {
146  return retrieve( type,
147  T::interfaceID(),
148  (IAlgTool*&)tool,
149  parent,
150  createIf );
151  }
152 
196  template <class T>
197  StatusCode retrieveTool ( const std::string& type ,
198  const std::string& name ,
199  T*& tool ,
200  const IInterface* parent = 0 ,
201  bool createIf = true )
202  {
203  return retrieve ( type,
204  name,
205  T::interfaceID(),
206  (IAlgTool*&)tool,
207  parent,
208  createIf );
209  }
210 
240  class Observer {
241  public:
242  virtual ~Observer() {}
243  virtual void onCreate(const IAlgTool*) {}
244  virtual void onRetrieve(const IAlgTool*) {}
245  };
246 
247  virtual void registerObserver(Observer *obs) = 0;
248  virtual void unRegisterObserver(Observer *obs) = 0;
249 
250 
251 };
252 
253 
254 #endif // GAUDIKERNEL_ITOOLSVC_H
The interface implemented by the IToolSvc base class.
Definition: IToolSvc.h:17
#define GAUDI_API
Definition: Kernel.h:108
Interface ID class.
Definition: IInterface.h:55
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:30
Definition of the basic interface.
Definition: IInterface.h:160
#define DeclareInterfaceID(name, major, minor)
Macro to declare the interface ID when using the new mechanism of extending and implementing interfac...
Definition: IInterface.h:23
The interface implemented by the AlgTool base class.
Definition: IAlgTool.h:23
string type
Definition: gaudirun.py:151