![]() |
The Gaudi Framework
v25r3
|
The ServiceManager class is in charge of the creation of concrete instances of Services. More...
#include <src/ApplicationMgr/ServiceManager.h>
Classes | |
struct | ServiceItem |
Public Types | |
typedef std::list< ServiceItem > | ListSvc |
typedef GaudiUtils::Map < std::string, std::string > | MapType |
![]() | |
typedef extends2 | base_class |
Typedef to this class. More... | |
typedef extend_interfaces2 < ISvcManager, ISvcLocator > | extend_interfaces_base |
Typedef to the base of this class. More... | |
typedef extend_interfaces_base::ext_iids | interfaces |
MPL set of all the implemented interfaces. More... | |
![]() | |
typedef CommonMessaging | base_class |
![]() | |
typedef implements1 | base_class |
Typedef to this class. More... | |
typedef extend_interfaces1 < IComponentManager > | extend_interfaces_base |
Typedef to the base of this class. More... | |
typedef extend_interfaces_base::ext_iids | interfaces |
MPL set of all the implemented interfaces. More... | |
![]() | |
typedef IComponentManager::iid::iids::type | ext_iids |
MPL set of interfaces extended by this one. More... | |
![]() | |
enum | Status { SUCCESS = 1, NO_INTERFACE, VERSMISMATCH, LAST_ERROR } |
Return status. More... | |
typedef Gaudi::InterfaceId < IInterface, 0, 0 > | iid |
Interface ID. More... | |
typedef mpl::set1< iid > | ext_iids |
Extra interfaces. More... | |
![]() | |
typedef mpl::fold< typename ISvcManager::iid::iids::type, typename ISvcLocator::iid::iids::type, mpl::insert< mpl::_1, mpl::_2 > >::type | ext_iids |
MPL set of interfaces extended by this one. More... | |
Public Member Functions | |
ServiceManager (IInterface *application) | |
default creator More... | |
SmartIF< ISvcLocator > & | serviceLocator () const |
Function needed by CommonMessaging. More... | |
virtual | ~ServiceManager () |
virtual destructor More... | |
virtual const std::list < IService * > & | getServices () const |
Return the list of Services. More... | |
virtual bool | existsService (const std::string &name) const |
implementation of ISvcLocation::existsService More... | |
virtual StatusCode | addService (IService *svc, int prio=DEFAULT_SVC_PRIORITY) |
implementation of ISvcManager::addService More... | |
virtual StatusCode | addService (const Gaudi::Utils::TypeNameString &typeName, int prio=DEFAULT_SVC_PRIORITY) |
implementation of ISvcManager::addService More... | |
virtual StatusCode | removeService (IService *svc) |
implementation of ISvcManager::removeService More... | |
virtual StatusCode | removeService (const std::string &name) |
implementation of ISvcManager::removeService More... | |
virtual StatusCode | declareSvcType (const std::string &svcname, const std::string &svctype) |
implementation of ISvcManager::declareSvcType More... | |
virtual SmartIF< IService > & | createService (const Gaudi::Utils::TypeNameString &nametype) |
implementation of ISvcManager::createService More... | |
virtual StatusCode | initialize () |
Initialization (from CONFIGURED to INITIALIZED). More... | |
virtual StatusCode | start () |
Start (from INITIALIZED to RUNNING). More... | |
virtual StatusCode | stop () |
Stop (from RUNNING to INITIALIZED). More... | |
virtual StatusCode | finalize () |
Finalize (from INITIALIZED to CONFIGURED). More... | |
virtual StatusCode | reinitialize () |
Initialization (from INITIALIZED or RUNNING to INITIALIZED, via CONFIGURED). More... | |
virtual StatusCode | restart () |
Initialization (from RUNNING to RUNNING, via INITIALIZED). More... | |
virtual int | getPriority (const std::string &name) const |
manage priorities of services More... | |
virtual StatusCode | setPriority (const std::string &name, int pri) |
virtual bool | loopCheckEnabled () const |
Get the value of the initialization loop check flag. More... | |
virtual void | setLoopCheckEnabled (bool en) |
Set the value of the initialization loop check flag. More... | |
const std::string & | name () const |
Return the name of the manager (implementation of INamedInterface) More... | |
virtual SmartIF< IService > & | service (const Gaudi::Utils::TypeNameString &typeName, const bool createIf=true) |
Returns a smart pointer to a service. More... | |
![]() | |
extends2 (A1 a1, A2 a2, A3 a3) | |
Templated constructor with 3 arguments. More... | |
extends2 (A1 a1, A2 a2) | |
Templated constructor with 2 arguments. More... | |
extends2 (A1 a1) | |
Templated constructor with 1 argument. More... | |
extends2 () | |
Default constructor. More... | |
virtual void * | i_cast (const InterfaceID &tid) const |
Implementation of IInterface::i_cast. More... | |
virtual StatusCode | queryInterface (const InterfaceID &ti, void **pp) |
Implementation of IInterface::queryInterface. More... | |
virtual std::vector< std::string > | getInterfaceNames () const |
Implementation of IInterface::getInterfaceNames. More... | |
virtual | ~extends2 () |
Virtual destructor. More... | |
![]() | |
ComponentManager (IInterface *application, const InterfaceID &baseIID) | |
Constructor. More... | |
virtual const InterfaceID & | componentBaseInterface () const |
Basic interface id of the managed components. More... | |
virtual | ~ComponentManager () |
Virtual destructor. More... | |
virtual StatusCode | configure () |
Configuration (from OFFLINE to CONFIGURED). More... | |
virtual StatusCode | terminate () |
Initialization (from CONFIGURED to OFFLINE). More... | |
virtual Gaudi::StateMachine::State | FSMState () const |
Get the current state. More... | |
virtual Gaudi::StateMachine::State | targetFSMState () const |
When we are in the middle of a transition, get the state where the transition is leading us. More... | |
![]() | |
CommonMessaging (const A1 &a1, const A2 &a2, const A3 &a3) | |
Templated constructor with 3 arguments. More... | |
CommonMessaging (const A1 &a1, const A2 &a2) | |
Templated constructor with 2 arguments. More... | |
CommonMessaging (const A1 &a1) | |
Templated constructor with 1 argument. More... | |
CommonMessaging () | |
Default constructor. More... | |
virtual | ~CommonMessaging () |
Virtual destructor. More... | |
SmartIF< IMessageSvc > & | msgSvc () const |
The standard message service. More... | |
MsgStream & | msgStream () const |
Return an uninitialized MsgStream. More... | |
MsgStream & | msgStream (const MSG::Level level) const |
Predefined configurable message stream for the efficient printouts. More... | |
MsgStream & | always () const |
shortcut for the method msgStream(MSG::ALWAYS) More... | |
MsgStream & | fatal () const |
shortcut for the method msgStream(MSG::FATAL) More... | |
MsgStream & | err () const |
shortcut for the method msgStream(MSG::ERROR) More... | |
MsgStream & | error () const |
shortcut for the method msgStream(MSG::ERROR) More... | |
MsgStream & | warning () const |
shortcut for the method msgStream(MSG::WARNING) More... | |
MsgStream & | info () const |
shortcut for the method msgStream(MSG::INFO) More... | |
MsgStream & | debug () const |
shortcut for the method msgStream(MSG::DEBUG) More... | |
MsgStream & | verbose () const |
shortcut for the method msgStream(MSG::VERBOSE) More... | |
MsgStream & | msg () const |
shortcut for the method msgStream(MSG::INFO) More... | |
MSG::Level | msgLevel () const |
get the output level from the embedded MsgStream More... | |
bool | msgLevel (MSG::Level lvl) const |
get the output level from the embedded MsgStream More... | |
![]() | |
virtual | ~extend_interfaces1 () |
Virtual destructor. More... | |
![]() | |
DeclareInterfaceID (IComponentManager, 1, 0) | |
InterfaceID. More... | |
virtual | ~IComponentManager () |
Virtual destructor. More... | |
![]() | |
DeclareInterfaceID (IStateful, 1, 0) | |
InterfaceID. More... | |
virtual | ~IStateful () |
![]() | |
virtual unsigned long | addRef ()=0 |
Increment the reference count of Interface instance. More... | |
virtual unsigned long | release ()=0 |
Release Interface instance. More... | |
virtual unsigned long | refCount () const =0 |
Current reference count. More... | |
virtual | ~IInterface () |
Virtual destructor. More... | |
![]() | |
virtual | ~extend_interfaces2 () |
Virtual destructor. More... | |
![]() | |
DeclareInterfaceID (ISvcManager, 4, 0) | |
InterfaceID. More... | |
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. More... | |
virtual StatusCode | declareSvcFactory (const ISvcFactory &, const std::string &) |
Declare an abstract factory for a given service type. More... | |
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. More... | |
virtual StatusCode | getFactory (const std::string &, const ISvcFactory *&) const |
Access to service factory by name to create unmanaged services. More... | |
virtual StatusCode | initializeServices () |
Initializes the list of "active" services. More... | |
virtual StatusCode | startServices () |
Starts the list of "active" services. More... | |
virtual StatusCode | stopServices () |
Stops the list of "active" services. More... | |
virtual StatusCode | finalizeServices () |
Finalizes the list of "active" services. More... | |
virtual StatusCode | reinitializeServices () |
Reinitializes the list of "active" services. More... | |
virtual StatusCode | restartServices () |
Restarts the list of "active" services. More... | |
![]() | |
DeclareInterfaceID (ISvcLocator, 3, 0) | |
InterfaceID. More... | |
virtual StatusCode | getService (const Gaudi::Utils::TypeNameString &typeName, IService *&svc, const bool createIf=true) |
Get a reference to the service given a service name. More... | |
virtual StatusCode | getService (const Gaudi::Utils::TypeNameString &typeName, const InterfaceID &iid, IInterface *&pinterface) |
Get a specific interface pointer given a service name and interface id. More... | |
template<class T > | |
StatusCode | service (const Gaudi::Utils::TypeNameString &name, T *&svc, bool createIf=true) |
Templated method to access a service by name. More... | |
template<class T > | |
StatusCode | service (const std::string &type, const std::string &name, T *&svc, bool createIf=true) |
Templated method to access a service by type and name. More... | |
template<typename T > | |
SmartIF< T > | service (const Gaudi::Utils::TypeNameString &typeName, const bool createIf=true) |
Returns a smart pointer to the requested interface of a service. More... | |
Private Member Functions | |
ListSvc::iterator | find (const std::string &name) |
ListSvc::const_iterator | find (const std::string &name) const |
ListSvc::iterator | find (const IService *ptr) |
ListSvc::const_iterator | find (const IService *ptr) const |
void | dump () const |
Private Attributes | |
ListSvc | m_listsvc |
List of service maintained by ServiceManager. More... | |
MapType | m_maptype |
Map of service name and service type. More... | |
bool | m_loopCheck |
Check for service initialization loops. More... | |
SmartIF< IService > | m_appSvc |
Pointer to the application IService interface. More... | |
std::list< IService * > | m_listOfPtrs |
List of pointers to the know services used to implement getServices() More... | |
GaudiUtils::Map< InterfaceID, SmartIF< IInterface > > | m_defaultImplementations |
boost::recursive_mutex | m_svcinitmutex |
Mutex to synchronize shared service initialization between threads. More... | |
Additional Inherited Members | |
![]() | |
static const InterfaceID & | interfaceID () |
Return an instance of InterfaceID identifying the interface. More... | |
![]() | |
static const int | DEFAULT_SVC_PRIORITY = 100 |
![]() | |
void | updateMsgStreamOutputLevel (int level) |
Update the output level of the cached MsgStream. More... | |
![]() | |
SmartIF< IInterface > | m_application |
Pointer to the owner of the manager. More... | |
SmartIF< IStateful > | m_stateful |
Pointer to the IStateful interface of the owner. More... | |
InterfaceID | m_basicInterfaceId |
Basic interface id of the managed components. More... | |
SmartIF< ISvcLocator > | m_svcLocator |
Service locator (needed to access the MessageSvc) More... | |
![]() | |
SmartIF< IMessageSvc > | m_msgsvc |
Pointer to the message service;. More... | |
std::auto_ptr< MsgStream > | m_msgStream |
The predefined message stream. More... | |
bool | m_streamWithService |
Flag to create a new MsgStream if it was created without the message service. More... | |
The ServiceManager class is in charge of the creation of concrete instances of Services.
The ApplicationMgr delegates the creation and bookkeeping of services to the ServiceManager. In order to be able to create services from which it is not know the concrete type it requires that the services has been declared in one of 3 possible ways: an abstract static creator function, a dynamic link library or an abstract factory reference.
Definition at line 36 of file ServiceManager.h.
typedef std::list<ServiceItem> ServiceManager::ListSvc |
Definition at line 57 of file ServiceManager.h.
typedef GaudiUtils::Map<std::string, std::string> ServiceManager::MapType |
Definition at line 58 of file ServiceManager.h.
ServiceManager::ServiceManager | ( | IInterface * | application | ) |
default creator
Definition at line 27 of file ServiceManager.cpp.
|
virtual |
virtual destructor
Definition at line 39 of file ServiceManager.cpp.
|
virtual |
implementation of ISvcManager::addService
Implements ISvcManager.
Definition at line 95 of file ServiceManager.cpp.
|
virtual |
implementation of ISvcManager::addService
Implements ISvcManager.
Definition at line 110 of file ServiceManager.cpp.
|
virtual |
implementation of ISvcManager::createService
Implements ISvcManager.
Definition at line 48 of file ServiceManager.cpp.
|
virtual |
implementation of ISvcManager::declareSvcType
Implements ISvcManager.
Definition at line 234 of file ServiceManager.cpp.
|
private |
Definition at line 529 of file ServiceManager.cpp.
|
virtual |
implementation of ISvcLocation::existsService
Implements ISvcLocator.
Definition at line 203 of file ServiceManager.cpp.
|
virtual |
Finalize (from INITIALIZED to CONFIGURED).
Reimplemented from ComponentManager.
Definition at line 402 of file ServiceManager.cpp.
|
inlineprivate |
Definition at line 131 of file ServiceManager.h.
|
inlineprivate |
Definition at line 134 of file ServiceManager.h.
|
inlineprivate |
Definition at line 137 of file ServiceManager.h.
|
inlineprivate |
Definition at line 140 of file ServiceManager.h.
|
virtual |
manage priorities of services
Implements ISvcManager.
Definition at line 494 of file ServiceManager.cpp.
|
virtual |
Return the list of Services.
Implements ISvcLocator.
Definition at line 192 of file ServiceManager.cpp.
|
virtual |
Initialization (from CONFIGURED to INITIALIZED).
Reimplemented from ComponentManager.
Definition at line 248 of file ServiceManager.cpp.
|
virtual |
Get the value of the initialization loop check flag.
Implements ISvcManager.
Definition at line 515 of file ServiceManager.cpp.
|
inlinevirtual |
Return the name of the manager (implementation of INamedInterface)
Implements CommonMessaging< implements1< IComponentManager > >.
Definition at line 116 of file ServiceManager.h.
|
virtual |
Initialization (from INITIALIZED or RUNNING to INITIALIZED, via CONFIGURED).
Reimplemented from ComponentManager.
Definition at line 356 of file ServiceManager.cpp.
|
virtual |
implementation of ISvcManager::removeService
Implements ISvcManager.
Definition at line 210 of file ServiceManager.cpp.
|
virtual |
implementation of ISvcManager::removeService
Implements ISvcManager.
Definition at line 222 of file ServiceManager.cpp.
|
virtual |
Initialization (from RUNNING to RUNNING, via INITIALIZED).
Reimplemented from ComponentManager.
Definition at line 379 of file ServiceManager.cpp.
|
virtual |
Returns a smart pointer to a service.
Implements ISvcLocator.
Definition at line 156 of file ServiceManager.cpp.
|
inlinevirtual |
Function needed by CommonMessaging.
Reimplemented from ComponentManager.
Definition at line 64 of file ServiceManager.h.
|
virtual |
Set the value of the initialization loop check flag.
Implements ISvcManager.
Definition at line 521 of file ServiceManager.cpp.
|
virtual |
Implements ISvcManager.
Definition at line 502 of file ServiceManager.cpp.
|
virtual |
Start (from INITIALIZED to RUNNING).
Reimplemented from ComponentManager.
Definition at line 283 of file ServiceManager.cpp.
|
virtual |
Stop (from RUNNING to INITIALIZED).
Reimplemented from ComponentManager.
Definition at line 320 of file ServiceManager.cpp.
Pointer to the application IService interface.
Definition at line 150 of file ServiceManager.h.
|
private |
Definition at line 155 of file ServiceManager.h.
|
mutableprivate |
List of pointers to the know services used to implement getServices()
Definition at line 153 of file ServiceManager.h.
|
private |
List of service maintained by ServiceManager.
Definition at line 145 of file ServiceManager.h.
|
private |
Check for service initialization loops.
Definition at line 147 of file ServiceManager.h.
|
private |
Map of service name and service type.
Definition at line 146 of file ServiceManager.h.
|
private |
Mutex to synchronize shared service initialization between threads.
Definition at line 158 of file ServiceManager.h.