![]() |
The Gaudi Framework
master (ff829712)
|
The ServiceManager class is in charge of the creation of concrete instances of Services. More...
#include </builds/gaudi/Gaudi/GaudiCoreSvc/src/ApplicationMgr/ServiceManager.h>
Classes | |
struct | ServiceItem |
Public Types | |
typedef std::list< ServiceItem > | ListSvc |
typedef std::map< std::string, std::string, std::less<> > | MapType |
![]() | |
using | base_class |
Typedef to this class. | |
using | extend_interfaces_base |
Typedef to the base of this class. | |
![]() | |
using | base_class |
![]() | |
using | ext_iids |
take union of the ext_iids of all Interfaces... | |
Public Member Functions | |
ServiceManager (IInterface *application) | |
default creator | |
SmartIF< ISvcLocator > & | serviceLocator () const override |
Function needed by CommonMessaging. | |
~ServiceManager () override | |
virtual destructor | |
const std::list< IService * > & | getServices () const override |
Return the list of Services. | |
bool | existsService (std::string_view name) const override |
implementation of ISvcLocation::existsService | |
StatusCode | addService (IService *svc, int prio=DEFAULT_SVC_PRIORITY) override |
implementation of ISvcManager::addService | |
StatusCode | addService (const Gaudi::Utils::TypeNameString &typeName, int prio=DEFAULT_SVC_PRIORITY) override |
implementation of ISvcManager::addService | |
StatusCode | removeService (IService *svc) override |
implementation of ISvcManager::removeService | |
StatusCode | removeService (std::string_view name) override |
implementation of ISvcManager::removeService | |
StatusCode | declareSvcType (std::string svcname, std::string svctype) override |
implementation of ISvcManager::declareSvcType | |
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... | |
StatusCode | initialize () override |
Initialization (from CONFIGURED to INITIALIZED). | |
StatusCode | start () override |
Start (from INITIALIZED to RUNNING). | |
StatusCode | stop () override |
Stop (from RUNNING to INITIALIZED). | |
StatusCode | finalize () override |
Finalize (from INITIALIZED to CONFIGURED). | |
StatusCode | reinitialize () override |
Initialization (from INITIALIZED or RUNNING to INITIALIZED, via CONFIGURED). | |
StatusCode | restart () override |
Initialization (from RUNNING to RUNNING, via INITIALIZED). | |
int | getPriority (std::string_view name) const override |
manage priorities of services | |
StatusCode | setPriority (std::string_view name, int pri) override |
bool | loopCheckEnabled () const override |
Get the value of the initialization loop check flag. | |
void | setLoopCheckEnabled (bool en) override |
Set the value of the initialization loop check flag. | |
const std::string & | name () const override |
Return the name of the manager (implementation of INamedInterface) | |
SmartIF< IService > & | service (const Gaudi::Utils::TypeNameString &typeName, const bool createIf=true) override |
Returns a smart pointer to a service. | |
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. | |
void | outputLevelUpdate () override |
Function to call to update the outputLevel of the components (after a change in MessageSvc). | |
![]() | |
void const * | i_cast (const InterfaceID &tid) const override |
Implementation of IInterface::i_cast. | |
StatusCode | queryInterface (const InterfaceID &ti, void **pp) override |
Implementation of IInterface::queryInterface. | |
std::vector< std::string > | getInterfaceNames () const override |
Implementation of IInterface::getInterfaceNames. | |
![]() | |
ComponentManager (IInterface *application, const InterfaceID &baseIID) | |
Constructor. | |
const InterfaceID & | componentBaseInterface () const override |
Basic interface id of the managed components. | |
StatusCode | queryInterface (const InterfaceID &iid, void **pinterface) override |
Specialized queryInterface implementation. | |
void const * | i_cast (const InterfaceID &iid) const override |
Specialized i_cast implementation. | |
SmartIF< ISvcLocator > & | serviceLocator () const override |
StatusCode | configure () override |
Configuration (from OFFLINE to CONFIGURED). | |
StatusCode | initialize () override |
Initialization (from CONFIGURED to INITIALIZED). | |
StatusCode | start () override |
Start (from INITIALIZED to RUNNING). | |
StatusCode | stop () override |
Stop (from RUNNING to INITIALIZED). | |
StatusCode | finalize () override |
Finalize (from INITIALIZED to CONFIGURED). | |
StatusCode | terminate () override |
Initialization (from CONFIGURED to OFFLINE). | |
StatusCode | reinitialize () override |
Initialization (from INITIALIZED or RUNNING to INITIALIZED, via CONFIGURED). | |
StatusCode | restart () override |
Initialization (from RUNNING to RUNNING, via INITIALIZED). | |
Gaudi::StateMachine::State | FSMState () const override |
Get the current state. | |
Gaudi::StateMachine::State | targetFSMState () const override |
When we are in the middle of a transition, get the state where the transition is leading us. | |
![]() | |
MSG::Level | msgLevel () const |
get the cached level (originally extracted from the embedded MsgStream) | |
bool | msgLevel (MSG::Level lvl) const |
get the output level from the embedded MsgStream | |
![]() | |
virtual | ~CommonMessagingBase ()=default |
Virtual destructor. | |
const SmartIF< IMessageSvc > & | msgSvc () const |
The standard message service. | |
MsgStream & | msgStream () const |
Return an uninitialized MsgStream. | |
MsgStream & | msgStream (const MSG::Level level) const |
Predefined configurable message stream for the efficient printouts. | |
MsgStream & | always () const |
shortcut for the method msgStream(MSG::ALWAYS) | |
MsgStream & | fatal () const |
shortcut for the method msgStream(MSG::FATAL) | |
MsgStream & | err () const |
shortcut for the method msgStream(MSG::ERROR) | |
MsgStream & | error () const |
shortcut for the method msgStream(MSG::ERROR) | |
MsgStream & | warning () const |
shortcut for the method msgStream(MSG::WARNING) | |
MsgStream & | info () const |
shortcut for the method msgStream(MSG::INFO) | |
MsgStream & | debug () const |
shortcut for the method msgStream(MSG::DEBUG) | |
MsgStream & | verbose () const |
shortcut for the method msgStream(MSG::VERBOSE) | |
MsgStream & | msg () const |
shortcut for the method msgStream(MSG::INFO) | |
Private Member Functions | |
ListSvc::iterator | find (std::string_view name) |
ListSvc::const_iterator | find (std::string_view 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. | |
MapType | m_maptype |
Map of service name and service type. | |
bool | m_loopCheck = true |
Check for service initialization loops. | |
SmartIF< IService > | m_appSvc |
Pointer to the application IService interface. | |
std::list< IService * > | m_listOfPtrs |
List of pointers to the know services used to implement getServices() | |
GaudiUtils::Map< InterfaceID, SmartIF< IInterface > > | m_defaultImplementations |
std::recursive_mutex | m_gLock |
Mutex to synchronize shared service initialization between threads. | |
std::map< std::string, std::recursive_mutex > | m_lockMap |
Additional Inherited Members | |
![]() | |
MSG::Level | setUpMessaging () const |
Set up local caches. | |
MSG::Level | resetMessaging () |
Reinitialize internal states. | |
void | updateMsgStreamOutputLevel (int level) |
Update the output level of the cached MsgStream. | |
![]() | |
SmartIF< IInterface > | m_application |
Pointer to the owner of the manager. | |
SmartIF< IStateful > | m_stateful |
Pointer to the IStateful interface of the owner. | |
InterfaceID | m_basicInterfaceId |
Basic interface id of the managed components. | |
SmartIF< ISvcLocator > | m_svcLocator |
Service locator (needed to access the MessageSvc) | |
friend | ApplicationMgr |
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 40 of file ServiceManager.h.
typedef std::list<ServiceItem> ServiceManager::ListSvc |
Definition at line 53 of file ServiceManager.h.
typedef std::map<std::string, std::string, std::less<> > ServiceManager::MapType |
Definition at line 54 of file ServiceManager.h.
ServiceManager::ServiceManager | ( | IInterface * | application | ) |
default creator
Definition at line 50 of file ServiceManager.cpp.
|
override |
virtual destructor
Definition at line 57 of file ServiceManager.cpp.
|
override |
implementation of ISvcManager::addService
Definition at line 120 of file ServiceManager.cpp.
|
override |
implementation of ISvcManager::addService
Definition at line 108 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 62 of file ServiceManager.cpp.
|
override |
implementation of ISvcManager::declareSvcType
Definition at line 225 of file ServiceManager.cpp.
|
private |
Definition at line 446 of file ServiceManager.cpp.
|
override |
implementation of ISvcLocation::existsService
Definition at line 209 of file ServiceManager.cpp.
|
override |
Finalize (from INITIALIZED to CONFIGURED).
Definition at line 358 of file ServiceManager.cpp.
|
inlineprivate |
Definition at line 140 of file ServiceManager.h.
|
inlineprivate |
Definition at line 144 of file ServiceManager.h.
|
inlineprivate |
|
inlineprivate |
|
override |
manage priorities of services
Definition at line 431 of file ServiceManager.cpp.
|
override |
Return the list of Services.
Definition at line 202 of file ServiceManager.cpp.
|
override |
Initialization (from CONFIGURED to INITIALIZED).
Definition at line 230 of file ServiceManager.cpp.
|
override |
Get the value of the initialization loop check flag.
Definition at line 443 of file ServiceManager.cpp.
|
inlineoverride |
Return the name of the manager (implementation of INamedInterface)
Definition at line 114 of file ServiceManager.h.
|
override |
Function to call to update the outputLevel of the components (after a change in MessageSvc).
Definition at line 471 of file ServiceManager.cpp.
|
override |
Initialization (from INITIALIZED or RUNNING to INITIALIZED, via CONFIGURED).
Definition at line 322 of file ServiceManager.cpp.
|
override |
implementation of ISvcManager::removeService
Definition at line 211 of file ServiceManager.cpp.
|
override |
implementation of ISvcManager::removeService
Definition at line 218 of file ServiceManager.cpp.
|
override |
Initialization (from RUNNING to RUNNING, via INITIALIZED).
Definition at line 340 of file ServiceManager.cpp.
|
inline |
Returns a smart pointer to the requested interface of a service.
Definition at line 124 of file ServiceManager.h.
|
override |
Returns a smart pointer to a service.
Definition at line 159 of file ServiceManager.cpp.
|
inlineoverride |
|
override |
Set the value of the initialization loop check flag.
Definition at line 444 of file ServiceManager.cpp.
|
override |
Definition at line 436 of file ServiceManager.cpp.
|
override |
Start (from INITIALIZED to RUNNING).
Definition at line 261 of file ServiceManager.cpp.
|
override |
Stop (from RUNNING to INITIALIZED).
Definition at line 291 of file ServiceManager.cpp.
Pointer to the application IService interface.
Definition at line 168 of file ServiceManager.h.
|
private |
Definition at line 173 of file ServiceManager.h.
|
mutableprivate |
Mutex to synchronize shared service initialization between threads.
Definition at line 176 of file ServiceManager.h.
|
mutableprivate |
List of pointers to the know services used to implement getServices()
Definition at line 171 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 150 of file ServiceManager.h.
|
mutableprivate |
Definition at line 177 of file ServiceManager.h.
|
private |
Check for service initialization loops.
Definition at line 165 of file ServiceManager.h.
|
private |
Map of service name and service type.
Definition at line 164 of file ServiceManager.h.