Loading [MathJax]/extensions/tex2jax.js
The Gaudi Framework  v31r0 (aeb156f0)
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
ISvcManager.h
Go to the documentation of this file.
1 #ifndef GAUDIKERNEL_ISVCMANAGER_H
2 #define GAUDIKERNEL_ISVCMANAGER_H
3 
4 // Include files
6 #include "GaudiKernel/SmartIF.h"
8 #include <string>
9 
10 // Forward class declaration
11 #if defined( GAUDI_V20_COMPAT ) || ( !defined( GAUDI_V22_API ) || defined( G22_NEW_SVCLOCATOR ) )
12 class ISvcFactory;
13 # include "GaudiKernel/IService.h"
14 #else
15 class IService;
16 #endif
17 class ISvcLocator;
18 
28 class GAUDI_API ISvcManager : virtual public IComponentManager {
29 public:
32 
33  static const int DEFAULT_SVC_PRIORITY = 100;
34 
40  virtual StatusCode addService( IService* svc, int prio = DEFAULT_SVC_PRIORITY ) = 0;
41 
42 #if !defined( GAUDI_V22_API ) || defined( G22_NEW_SVCLOCATOR )
43 
48  virtual StatusCode addService( const std::string& typ, const std::string& nam, int prio ) {
49  return addService( Gaudi::Utils::TypeNameString( nam, typ ), prio );
50  }
51 #endif
52 
58  virtual StatusCode addService( const Gaudi::Utils::TypeNameString& nametype, int prio = DEFAULT_SVC_PRIORITY ) = 0;
59 
65  virtual StatusCode removeService( IService* svc ) = 0;
66 
72  virtual StatusCode removeService( const std::string& nam ) = 0;
73 
74 #if !defined( GAUDI_V22_API ) || defined( G22_NEW_SVCLOCATOR )
75 
81  virtual StatusCode declareSvcFactory( const ISvcFactory& /*factory*/, const std::string& /*svctype*/ ) {
82  // This function is never used.
83  return StatusCode::FAILURE;
84  }
85 #endif
86 
93  virtual StatusCode declareSvcType( const std::string& svcname, const std::string& svctype ) = 0;
94 
110  virtual SmartIF<IService>& createService( const Gaudi::Utils::TypeNameString& nametype ) = 0;
111 
112 #if !defined( GAUDI_V22_API ) || defined( G22_NEW_SVCLOCATOR )
113 
121  virtual StatusCode createService( const std::string& svctype, const std::string& svcname, IService*& svc ) {
122  SmartIF<IService> s = createService( svctype + "/" + svcname );
123  svc = s.get();
124  if ( svc ) {
125  svc->addRef(); // Needed to maintain the correct reference counting.
126  return StatusCode::SUCCESS;
127  }
128  return StatusCode::FAILURE;
129  }
130 
137  virtual StatusCode getFactory( const std::string& /*svc_type*/, const ISvcFactory*& /*fac*/ ) const {
138  // This function is never used.
139  return StatusCode::FAILURE;
140  }
141 
146  virtual StatusCode initializeServices() { return initialize(); }
147 
152  virtual StatusCode startServices() { return start(); }
153 
158  virtual StatusCode stopServices() { return stop(); }
159 
164  virtual StatusCode finalizeServices() { return finalize(); }
165 
171 
176  virtual StatusCode restartServices() { return restart(); }
177 #endif
178 
179  virtual int getPriority( const std::string& name ) const = 0;
180  virtual StatusCode setPriority( const std::string& name, int pri ) = 0;
181 
183  virtual bool loopCheckEnabled() const = 0;
185  virtual void setLoopCheckEnabled( bool en = true ) = 0;
186 };
187 
188 #endif // GAUDIKERNEL_ISVCMANAGER_H
DeclareInterfaceID(IComponentManager, 1, 0)
InterfaceID.
The ISvcLocator is the interface implemented by the Service Factory in the Application Manager to loc...
Definition: ISvcLocator.h:25
virtual StatusCode reinitializeServices()
Reinitializes the list of "active" services.
Definition: ISvcManager.h:170
virtual StatusCode restartServices()
Restarts the list of "active" services.
Definition: ISvcManager.h:176
The ISvcManager is the interface implemented by the Service Factory in the Application Manager to sup...
Definition: ISvcManager.h:28
constexpr static const auto SUCCESS
Definition: StatusCode.h:85
virtual StatusCode stopServices()
Stops the list of "active" services.
Definition: ISvcManager.h:158
virtual StatusCode createService(const std::string &svctype, const std::string &svcname, IService *&svc)
Creates and instance of a service type that has been declared beforehand and assigns it a name...
Definition: ISvcManager.h:121
virtual StatusCode declareSvcFactory(const ISvcFactory &, const std::string &)
Declare an abstract factory for a given service type.
Definition: ISvcManager.h:81
virtual StatusCode start()=0
Start (from INITIALIZED to RUNNING).
STL class.
TYPE * get() const
Get interface pointer.
Definition: SmartIF.h:76
Helper class to parse a string of format "type/name".
virtual StatusCode stop()=0
Stop (from RUNNING to INITIALIZED).
virtual StatusCode reinitialize()=0
Initialization (from INITIALIZED or RUNNING to INITIALIZED, via CONFIGURED).
General service interface definition.
Definition: IService.h:18
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:50
virtual StatusCode addService(const std::string &typ, const std::string &nam, int prio)
Add a service to the "active" list of services of the factory.
Definition: ISvcManager.h:48
virtual StatusCode initializeServices()
Initializes the list of "active" services.
Definition: ISvcManager.h:146
virtual StatusCode initialize()=0
Initialization (from CONFIGURED to INITIALIZED).
virtual StatusCode finalizeServices()
Finalizes the list of "active" services.
Definition: ISvcManager.h:164
virtual StatusCode restart()=0
Initialization (from RUNNING to RUNNING, via INITIALIZED).
virtual StatusCode finalize()=0
Finalize (from INITIALIZED to CONFIGURED).
string s
Definition: gaudirun.py:312
constexpr static const auto FAILURE
Definition: StatusCode.h:86
virtual StatusCode startServices()
Starts the list of "active" services.
Definition: ISvcManager.h:152
#define GAUDI_API
Definition: Kernel.h:71
virtual StatusCode getFactory(const std::string &, const ISvcFactory *&) const
Access to service factory by name to create unmanaged services.
Definition: ISvcManager.h:137