![]() |
The Gaudi Framework
v27r0
|
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 |
![]() | |
using | base_class = extends |
Typedef to this class. More... | |
using | extend_interfaces_base = extend_interfaces< Interfaces...> |
Typedef to the base of this class. More... | |
using | base_class = extends |
Typedef to this class. More... | |
using | extend_interfaces_base = extend_interfaces< Interfaces...> |
Typedef to the base of this class. More... | |
![]() | |
using | ext_iids = typename Gaudi::interface_list_cat< typename Interfaces::ext_iids...>::type |
take union of the ext_iids of all Interfaces... More... | |
using | ext_iids = typename Gaudi::interface_list_cat< typename Interfaces::ext_iids...>::type |
take union of the ext_iids of all Interfaces... More... | |
Public Member Functions | |
ServiceManager (IInterface *application) | |
default creator More... | |
SmartIF< ISvcLocator > & | serviceLocator () const override |
Function needed by CommonMessaging. More... | |
~ServiceManager () override | |
virtual destructor More... | |
const std::list< IService * > & | getServices () const override |
Return the list of Services. More... | |
bool | existsService (const std::string &name) const override |
implementation of ISvcLocation::existsService More... | |
StatusCode | addService (IService *svc, int prio=DEFAULT_SVC_PRIORITY) override |
implementation of ISvcManager::addService More... | |
StatusCode | addService (const Gaudi::Utils::TypeNameString &typeName, int prio=DEFAULT_SVC_PRIORITY) override |
implementation of ISvcManager::addService More... | |
StatusCode | removeService (IService *svc) override |
implementation of ISvcManager::removeService More... | |
StatusCode | removeService (const std::string &name) override |
implementation of ISvcManager::removeService More... | |
StatusCode | declareSvcType (const std::string &svcname, const std::string &svctype) override |
implementation of ISvcManager::declareSvcType More... | |
SmartIF< IService > & | createService (const Gaudi::Utils::TypeNameString &nametype) override |
implementation of ISvcManager::createService NOTE: as this returns a &, we must guarantee that once created, these SmartIF remain pinned in their location, thus constraining the underlying implementation... More... | |
StatusCode | initialize () override |
Initialization (from CONFIGURED to INITIALIZED). More... | |
StatusCode | start () override |
Start (from INITIALIZED to RUNNING). More... | |
StatusCode | stop () override |
Stop (from RUNNING to INITIALIZED). More... | |
StatusCode | finalize () override |
Finalize (from INITIALIZED to CONFIGURED). More... | |
StatusCode | reinitialize () override |
Initialization (from INITIALIZED or RUNNING to INITIALIZED, via CONFIGURED). More... | |
StatusCode | restart () override |
Initialization (from RUNNING to RUNNING, via INITIALIZED). More... | |
int | getPriority (const std::string &name) const override |
manage priorities of services More... | |
StatusCode | setPriority (const std::string &name, int pri) override |
bool | loopCheckEnabled () const override |
Get the value of the initialization loop check flag. More... | |
void | setLoopCheckEnabled (bool en) override |
Set the value of the initialization loop check flag. More... | |
const std::string & | name () const override |
Return the name of the manager (implementation of INamedInterface) More... | |
SmartIF< IService > & | service (const Gaudi::Utils::TypeNameString &typeName, const bool createIf=true) override |
Returns a smart pointer to a service. 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... | |
![]() | |
void * | i_cast (const InterfaceID &tid) const override |
Implementation of IInterface::i_cast. More... | |
StatusCode | queryInterface (const InterfaceID &ti, void **pp) override |
Implementation of IInterface::queryInterface. More... | |
std::vector< std::string > | getInterfaceNames () const override |
Implementation of IInterface::getInterfaceNames. More... | |
~extends () override=default | |
Virtual destructor. More... | |
void * | i_cast (const InterfaceID &tid) const override |
Implementation of IInterface::i_cast. More... | |
StatusCode | queryInterface (const InterfaceID &ti, void **pp) override |
Implementation of IInterface::queryInterface. More... | |
std::vector< std::string > | getInterfaceNames () const override |
Implementation of IInterface::getInterfaceNames. More... | |
~extends () override=default | |
Virtual destructor. More... | |
![]() | |
~extend_interfaces () override=default | |
Virtual destructor. More... | |
~extend_interfaces () override=default | |
Virtual destructor. 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 This contains SmartIF<T> for all services – and because there can be SmartIF<T>& 'out there' that refer to these specific SmarIF<T>, we unfortunately must guarantee that they never move after creation. More... | |
MapType | m_maptype |
Map of service name and service type. More... | |
bool | m_loopCheck = true |
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 |
std::recursive_mutex | m_svcinitmutex |
Mutex to synchronize shared service initialization between threads. 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 35 of file ServiceManager.h.
typedef std::list<ServiceItem> ServiceManager::ListSvc |
Definition at line 56 of file ServiceManager.h.
typedef GaudiUtils::Map<std::string, std::string> ServiceManager::MapType |
Definition at line 57 of file ServiceManager.h.
ServiceManager::ServiceManager | ( | IInterface * | application | ) |
default creator
Definition at line 42 of file ServiceManager.cpp.
|
override |
virtual destructor
Definition at line 52 of file ServiceManager.cpp.
|
override |
implementation of ISvcManager::addService
Definition at line 100 of file ServiceManager.cpp.
|
override |
implementation of ISvcManager::addService
Definition at line 115 of file ServiceManager.cpp.
|
override |
implementation of ISvcManager::createService NOTE: as this returns a &, we must guarantee that once created, these SmartIF remain pinned in their location, thus constraining the underlying implementation...
Definition at line 59 of file ServiceManager.cpp.
|
override |
implementation of ISvcManager::declareSvcType
Definition at line 235 of file ServiceManager.cpp.
|
private |
Definition at line 511 of file ServiceManager.cpp.
|
override |
implementation of ISvcLocation::existsService
Definition at line 208 of file ServiceManager.cpp.
|
override |
Finalize (from INITIALIZED to CONFIGURED).
Definition at line 393 of file ServiceManager.cpp.
|
inlineprivate |
Definition at line 140 of file ServiceManager.h.
|
inlineprivate |
Definition at line 143 of file ServiceManager.h.
|
inlineprivate |
Definition at line 146 of file ServiceManager.h.
|
inlineprivate |
Definition at line 149 of file ServiceManager.h.
|
override |
manage priorities of services
Definition at line 478 of file ServiceManager.cpp.
|
override |
Return the list of Services.
Definition at line 195 of file ServiceManager.cpp.
|
override |
Initialization (from CONFIGURED to INITIALIZED).
Definition at line 246 of file ServiceManager.cpp.
|
override |
Get the value of the initialization loop check flag.
Definition at line 497 of file ServiceManager.cpp.
|
inlineoverride |
Return the name of the manager (implementation of INamedInterface)
Definition at line 119 of file ServiceManager.h.
|
override |
Initialization (from INITIALIZED or RUNNING to INITIALIZED, via CONFIGURED).
Definition at line 351 of file ServiceManager.cpp.
|
override |
implementation of ISvcManager::removeService
Definition at line 215 of file ServiceManager.cpp.
|
override |
implementation of ISvcManager::removeService
Definition at line 225 of file ServiceManager.cpp.
|
override |
Initialization (from RUNNING to RUNNING, via INITIALIZED).
Definition at line 372 of file ServiceManager.cpp.
|
override |
Returns a smart pointer to a service.
Definition at line 158 of file ServiceManager.cpp.
|
inline |
Returns a smart pointer to the requested interface of a service.
Definition at line 129 of file ServiceManager.h.
|
inlineoverride |
Function needed by CommonMessaging.
Definition at line 63 of file ServiceManager.h.
|
override |
Set the value of the initialization loop check flag.
Definition at line 503 of file ServiceManager.cpp.
|
override |
Definition at line 486 of file ServiceManager.cpp.
|
override |
Start (from INITIALIZED to RUNNING).
Definition at line 280 of file ServiceManager.cpp.
|
override |
Stop (from RUNNING to INITIALIZED).
Definition at line 316 of file ServiceManager.cpp.
Pointer to the application IService interface.
Definition at line 172 of file ServiceManager.h.
|
private |
Definition at line 177 of file ServiceManager.h.
|
mutableprivate |
List of pointers to the know services used to implement getServices()
Definition at line 175 of file ServiceManager.h.
|
private |
List of service maintained by ServiceManager This contains SmartIF<T> for all services – and because there can be SmartIF<T>& 'out there' that refer to these specific SmarIF<T>, we unfortunately must guarantee that they never move after creation.
Hence, we cannot use a plain std::vector here, as that may cause relocation and/or swapping of SmartIF<T>'s, and then the already handed out references may refer to the wrong item.... Note that we could use an std::vector<std::unique_ptr<ServiceItem>> (sometimes known as 'stable vector') as then the individual ServiceItems would stay pinned in their original location, but that would put ServiceItem on the heap... And maybe I'm way too paranoid...
Definition at line 154 of file ServiceManager.h.
|
private |
Check for service initialization loops.
Definition at line 169 of file ServiceManager.h.
|
private |
Map of service name and service type.
Definition at line 168 of file ServiceManager.h.
|
private |
Mutex to synchronize shared service initialization between threads.
Definition at line 180 of file ServiceManager.h.