| The Gaudi Framework v29r0 (ff2e7097)

- Main Page
- Related Pages
- Modules
- Namespaces
- Classes
- Files

- File List
- File Members

ISvcManager.h
Go to the documentation of this file.
1 #ifndef GAUDIKERNEL_ISVCMANAGER_H
2 #define GAUDIKERNEL_ISVCMANAGER_H
3
4 // Include files
5 #include "GaudiKernel/IComponentManager.h"
6 #include "GaudiKernel/SmartIF.h"
7 #include "GaudiKernel/TypeNameString.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 {
30 public:
32 DeclareInterfaceID( ISvcManager, 4, 0 );
33
34 static const int DEFAULT_SVC_PRIORITY = 100;
35
41 virtual StatusCode addService( IService* svc, int prio = DEFAULT_SVC_PRIORITY ) = 0;
42
43 #if !defined( GAUDI_V22_API ) || defined( G22_NEW_SVCLOCATOR )
44
49 virtual StatusCode addService( const std::string& typ, const std::string& nam, int prio )
50 {
51 return addService( Gaudi::Utils::TypeNameString( nam, typ ), prio );
52 }
53 #endif
54
60 virtual StatusCode addService( const Gaudi::Utils::TypeNameString& nametype, int prio = DEFAULT_SVC_PRIORITY ) = 0;
61
67 virtual StatusCode removeService( IService* svc ) = 0;
68
74 virtual StatusCode removeService( const std::string& nam ) = 0;
75
76 #if !defined( GAUDI_V22_API ) || defined( G22_NEW_SVCLOCATOR )
77
83 virtual StatusCode declareSvcFactory( const ISvcFactory& /*factory*/, const std::string& /*svctype*/ )
84 {
85 // This function is never used.
86 return StatusCode::FAILURE;
87 }
88 #endif
89
96 virtual StatusCode declareSvcType( const std::string& svcname, const std::string& svctype ) = 0;
97
113 virtual SmartIF<IService>& createService( const Gaudi::Utils::TypeNameString& nametype ) = 0;
114
115 #if !defined( GAUDI_V22_API ) || defined( G22_NEW_SVCLOCATOR )
116
124 virtual StatusCode createService( const std::string& svctype, const std::string& svcname, IService*& svc )
125 {
126 SmartIF<IService> s = createService( svctype + "/" + svcname );
127 svc = s.get();
128 if ( svc ) {
129 svc->addRef(); // Needed to maintain the correct reference counting.
130 return StatusCode::SUCCESS;
131 }
132 return StatusCode::FAILURE;
133 }
134
141 virtual StatusCode getFactory( const std::string& /*svc_type*/, const ISvcFactory*& /*fac*/ ) const
142 {
143 // This function is never used.
144 return StatusCode::FAILURE;
145 }
146
151 virtual StatusCode initializeServices() { return initialize(); }
152
157 virtual StatusCode startServices() { return start(); }
158
163 virtual StatusCode stopServices() { return stop(); }
164
169 virtual StatusCode finalizeServices() { return finalize(); }
170
175 virtual StatusCode reinitializeServices() { return reinitialize(); }
176
181 virtual StatusCode restartServices() { return restart(); }
182 #endif
183
184 virtual int getPriority( const std::string& name ) const = 0;
185 virtual StatusCode setPriority( const std::string& name, int pri ) = 0;
186
188 virtual bool loopCheckEnabled() const = 0;
190 virtual void setLoopCheckEnabled( bool en = true ) = 0;
191 };
192
193 #endif // GAUDIKERNEL_ISVCMANAGER_H
StatusCode::SUCCESS
Definition: StatusCode.h:31
IComponentManager::DeclareInterfaceID
DeclareInterfaceID(IComponentManager, 1, 0)
InterfaceID.
SmartIF< IService >
ISvcLocator
The ISvcLocator is the interface implemented by the Service Factory in the Application Manager to loc...
Definition: ISvcLocator.h:25
ISvcManager::reinitializeServices
virtual StatusCode reinitializeServices()
Reinitializes the list of "active" services.
Definition: ISvcManager.h:175
gaudiComponentHelp.name
name
Definition: gaudiComponentHelp.py:32
StatusCode::FAILURE
Definition: StatusCode.h:31
ISvcManager::restartServices
virtual StatusCode restartServices()
Restarts the list of "active" services.
Definition: ISvcManager.h:181
ISvcManager
The ISvcManager is the interface implemented by the Service Factory in the Application Manager to sup...
Definition: ISvcManager.h:28
IComponentManager
Definition: IComponentManager.h:11
ISvcManager::stopServices
virtual StatusCode stopServices()
Stops the list of "active" services.
Definition: ISvcManager.h:163
ISvcManager::createService
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:124
ISvcManager::declareSvcFactory
virtual StatusCode declareSvcFactory(const ISvcFactory &, const std::string &)
Declare an abstract factory for a given service type.
Definition: ISvcManager.h:83
IStateful::start
virtual StatusCode start()=0
Start (from INITIALIZED to RUNNING).
std::string
STL class.
SmartIF::get
TYPE * get() const
Get interface pointer.
Definition: SmartIF.h:82
Gaudi::Utils::TypeNameString
Helper class to parse a string of format "type/name".
Definition: TypeNameString.h:12
IStateful::stop
virtual StatusCode stop()=0
Stop (from RUNNING to INITIALIZED).
IStateful::reinitialize
virtual StatusCode reinitialize()=0
Initialization (from INITIALIZED or RUNNING to INITIALIZED, via CONFIGURED).
IService
General service interface definition.
Definition: IService.h:18
StatusCode
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:28
SmartIF.h
ISvcManager::addService
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:49
ISvcManager::initializeServices
virtual StatusCode initializeServices()
Initializes the list of "active" services.
Definition: ISvcManager.h:151
IStateful::initialize
virtual StatusCode initialize()=0
Initialization (from CONFIGURED to INITIALIZED).
IService.h
ISvcManager::finalizeServices
virtual StatusCode finalizeServices()
Finalizes the list of "active" services.
Definition: ISvcManager.h:169
IComponentManager.h
IStateful::restart
virtual StatusCode restart()=0
Initialization (from RUNNING to RUNNING, via INITIALIZED).
IStateful::finalize
virtual StatusCode finalize()=0
Finalize (from INITIALIZED to CONFIGURED).
gaudirun.s
string s
Definition: gaudirun.py:253
TypeNameString.h
ISvcManager::startServices
virtual StatusCode startServices()
Starts the list of "active" services.
Definition: ISvcManager.h:157
GAUDI_API
#define GAUDI_API
Definition: Kernel.h:110
ISvcManager::getFactory
virtual StatusCode getFactory(const std::string &, const ISvcFactory *&) const
Access to service factory by name to create unmanaged services.
Definition: ISvcManager.h:141