![]() |
The Gaudi Framework
v31r0 (aeb156f0)
|
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 = CommonMessaging |
![]() | |
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 | outputLevelUpdate () override |
Function to call to update the outputLevel of the components (after a change in MessageSvc). 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... | |
![]() | |
ComponentManager (IInterface *application, const InterfaceID &baseIID) | |
Constructor. More... | |
const InterfaceID & | componentBaseInterface () const override |
Basic interface id of the managed components. More... | |
StatusCode | queryInterface (const InterfaceID &iid, void **pinterface) override |
Specialized queryInterface implementation. More... | |
SmartIF< ISvcLocator > & | serviceLocator () const override |
StatusCode | configure () override |
Configuration (from OFFLINE to CONFIGURED). 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 | terminate () override |
Initialization (from CONFIGURED to OFFLINE). 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... | |
Gaudi::StateMachine::State | FSMState () const override |
Get the current state. More... | |
Gaudi::StateMachine::State | targetFSMState () const override |
When we are in the middle of a transition, get the state where the transition is leading us. More... | |
![]() | |
MSG::Level | msgLevel () const |
get the cached level (originally extracted from the embedded MsgStream) More... | |
bool | msgLevel (MSG::Level lvl) const |
get the output level from the embedded MsgStream More... | |
MSG::Level | outputLevel () const |
Backward compatibility function for getting the output level. More... | |
![]() | |
virtual | ~CommonMessagingBase ()=default |
Virtual destructor. More... | |
const 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... | |
Private Types | |
typedef boost::recursive_mutex | Mutex_t |
Mutex to synchronize shared service initialization between threads. More... | |
typedef boost::lock_guard< Mutex_t > | LockGuard_t |
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 |
Mutex_t | m_gLock |
std::map< std::string, Mutex_t > | m_lockMap |
Additional Inherited Members | |
![]() | |
MSG::Level | setUpMessaging () const |
Set up local caches. More... | |
MSG::Level | resetMessaging () |
Reinitialize internal states. More... | |
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... | |
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 36 of file ServiceManager.h.
typedef std::list<ServiceItem> ServiceManager::ListSvc |
Definition at line 49 of file ServiceManager.h.
|
private |
Definition at line 178 of file ServiceManager.h.
Definition at line 50 of file ServiceManager.h.
|
private |
Mutex to synchronize shared service initialization between threads.
Definition at line 177 of file ServiceManager.h.
ServiceManager::ServiceManager | ( | IInterface * | application | ) |
default creator
Definition at line 43 of file ServiceManager.cpp.
|
override |
virtual destructor
Definition at line 51 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 116 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 58 of file ServiceManager.cpp.
|
override |
implementation of ISvcManager::declareSvcType
Definition at line 241 of file ServiceManager.cpp.
|
private |
Definition at line 500 of file ServiceManager.cpp.
|
override |
implementation of ISvcLocation::existsService
Definition at line 214 of file ServiceManager.cpp.
|
override |
Finalize (from INITIALIZED to CONFIGURED).
Definition at line 394 of file ServiceManager.cpp.
|
inlineprivate |
Definition at line 133 of file ServiceManager.h.
|
inlineprivate |
Definition at line 137 of file ServiceManager.h.
|
inlineprivate |
Definition at line 141 of file ServiceManager.h.
|
inlineprivate |
Definition at line 145 of file ServiceManager.h.
|
override |
manage priorities of services
Definition at line 473 of file ServiceManager.cpp.
Return the list of Services.
Definition at line 204 of file ServiceManager.cpp.
|
override |
Initialization (from CONFIGURED to INITIALIZED).
Definition at line 251 of file ServiceManager.cpp.
|
override |
Get the value of the initialization loop check flag.
Definition at line 491 of file ServiceManager.cpp.
|
inlineoverride |
Return the name of the manager (implementation of INamedInterface)
Definition at line 110 of file ServiceManager.h.
|
override |
Function to call to update the outputLevel of the components (after a change in MessageSvc).
Definition at line 525 of file ServiceManager.cpp.
|
override |
Initialization (from INITIALIZED or RUNNING to INITIALIZED, via CONFIGURED).
Definition at line 352 of file ServiceManager.cpp.
|
override |
implementation of ISvcManager::removeService
Definition at line 221 of file ServiceManager.cpp.
|
override |
implementation of ISvcManager::removeService
Definition at line 231 of file ServiceManager.cpp.
|
override |
Initialization (from RUNNING to RUNNING, via INITIALIZED).
Definition at line 373 of file ServiceManager.cpp.
|
override |
Returns a smart pointer to a service.
Definition at line 159 of file ServiceManager.cpp.
|
inline |
Returns a smart pointer to the requested interface of a service.
Definition at line 120 of file ServiceManager.h.
|
inlineoverride |
Function needed by CommonMessaging.
Definition at line 56 of file ServiceManager.h.
|
override |
Set the value of the initialization loop check flag.
Definition at line 495 of file ServiceManager.cpp.
|
override |
Definition at line 480 of file ServiceManager.cpp.
|
override |
Start (from INITIALIZED to RUNNING).
Definition at line 285 of file ServiceManager.cpp.
|
override |
Stop (from RUNNING to INITIALIZED).
Definition at line 318 of file ServiceManager.cpp.
Pointer to the application IService interface.
Definition at line 169 of file ServiceManager.h.
|
private |
Definition at line 174 of file ServiceManager.h.
|
mutableprivate |
Definition at line 180 of file ServiceManager.h.
List of pointers to the know services used to implement getServices()
Definition at line 172 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 151 of file ServiceManager.h.
|
mutableprivate |
Definition at line 181 of file ServiceManager.h.
|
private |
Check for service initialization loops.
Definition at line 166 of file ServiceManager.h.
|
private |
Map of service name and service type.
Definition at line 165 of file ServiceManager.h.