The Gaudi Framework
master (37c0b60a)
|
#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 |
Public Types inherited from extends< ComponentManager, ISvcManager, ISvcLocator > | |
using | base_class = extends |
Typedef to this class. More... | |
using | extend_interfaces_base = extend_interfaces< Interfaces... > |
Typedef to the base of this class. More... | |
Public Types inherited from CommonMessaging< implements< IComponentManager > > | |
using | base_class = CommonMessaging |
Public Types inherited from extend_interfaces< Interfaces... > | |
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 (std::string_view 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 (std::string_view name) override |
implementation of ISvcManager::removeService More... | |
StatusCode | declareSvcType (std::string svcname, 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 (std::string_view name) const override |
manage priorities of services More... | |
StatusCode | setPriority (std::string_view 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... | |
virtual StatusCode | addService (IService *svc, int prio=DEFAULT_SVC_PRIORITY)=0 |
Add a service to the "active" list of services of the factory. 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 | addService (const Gaudi::Utils::TypeNameString &nametype, int prio=DEFAULT_SVC_PRIORITY)=0 |
Add a service to the "active" list of services of the factory. More... | |
virtual SmartIF< IService > & | createService (const Gaudi::Utils::TypeNameString &nametype)=0 |
Creates and instance of a service type that has been declared beforehand and assigns it a name. 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... | |
Public Member Functions inherited from extends< ComponentManager, ISvcManager, ISvcLocator > | |
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... | |
Public Member Functions inherited from ComponentManager | |
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... | |
Public Member Functions inherited from CommonMessaging< implements< IComponentManager > > | |
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... | |
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. 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_gLock |
Mutex to synchronize shared service initialization between threads. More... | |
std::map< std::string, std::recursive_mutex > | m_lockMap |
Additional Inherited Members | |
Protected Member Functions inherited from CommonMessaging< implements< IComponentManager > > | |
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... | |
Protected Attributes inherited from ComponentManager | |
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 46 of file ServiceManager.h.
typedef std::list<ServiceItem> ServiceManager::ListSvc |
Definition at line 59 of file ServiceManager.h.
typedef std::map<std::string, std::string, std::less<> > ServiceManager::MapType |
Definition at line 60 of file ServiceManager.h.
ServiceManager::ServiceManager | ( | IInterface * | application | ) |
|
override |
virtual StatusCode ISvcManager::addService |
Add a service to the "active" list of services of the factory.
svc | Pointer to the service |
|
override |
implementation of ISvcManager::addService
Definition at line 135 of file ServiceManager.cpp.
|
inline |
Add a service to the "active" list of services of the factory.
svc | Pointer to the service |
Definition at line 59 of file ISvcManager.h.
|
override |
virtual StatusCode ISvcManager::addService |
Add a service to the "active" list of services of the factory.
svc | Pointer to the service |
|
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 69 of file ServiceManager.cpp.
Creates and instance of a service type that has been declared beforehand and assigns it a name.
It returns a pointer to an IService.
nametype | name/type of the service to create |
NOTE: as this returns a &, the underlying implementation must guarantee that once created, these SmartIF remain pinned in their location, thus constraining the underlying implementation (i.e. one cannot use something like std::vector<SmartIF<IService>>). If this interface had used value-semantics, and returned just plain SmartIF<IService> (i.e. WITHOUT the &) then the underlying implementation would have much more freedom)
|
inline |
Creates and instance of a service type that has been declared beforehand and assigns it a name.
It returns a pointer to an IService.
Definition at line 134 of file ISvcManager.h.
|
override |
|
private |
Definition at line 513 of file ServiceManager.cpp.
|
override |
|
override |
Finalize (from INITIALIZED to CONFIGURED).
Definition at line 410 of file ServiceManager.cpp.
|
inlineprivate |
|
inlineprivate |
|
inlineprivate |
|
inlineprivate |
|
override |
Return the list of Services.
Definition at line 222 of file ServiceManager.cpp.
|
override |
Initialization (from CONFIGURED to INITIALIZED).
Definition at line 267 of file ServiceManager.cpp.
|
override |
Get the value of the initialization loop check flag.
Definition at line 504 of file ServiceManager.cpp.
|
inlineoverride |
Return the name of the manager (implementation of INamedInterface)
Definition at line 120 of file ServiceManager.h.
|
override |
Function to call to update the outputLevel of the components (after a change in MessageSvc).
Definition at line 538 of file ServiceManager.cpp.
|
override |
Initialization (from INITIALIZED or RUNNING to INITIALIZED, via CONFIGURED).
Definition at line 368 of file ServiceManager.cpp.
|
override |
|
override |
|
override |
Initialization (from RUNNING to RUNNING, via INITIALIZED).
Definition at line 389 of file ServiceManager.cpp.
|
inline |
Returns a smart pointer to the requested interface of a service.
Definition at line 130 of file ServiceManager.h.
|
override |
Returns a smart pointer to a service.
Definition at line 178 of file ServiceManager.cpp.
|
inlineoverride |
|
override |
Set the value of the initialization loop check flag.
Definition at line 508 of file ServiceManager.cpp.
|
override |
Definition at line 493 of file ServiceManager.cpp.
|
override |
Start (from INITIALIZED to RUNNING).
Definition at line 301 of file ServiceManager.cpp.
|
override |
Stop (from RUNNING to INITIALIZED).
Definition at line 334 of file ServiceManager.cpp.
Pointer to the application IService interface.
Definition at line 179 of file ServiceManager.h.
|
private |
Definition at line 184 of file ServiceManager.h.
|
mutableprivate |
Mutex to synchronize shared service initialization between threads.
Definition at line 187 of file ServiceManager.h.
List of pointers to the know services used to implement getServices()
Definition at line 182 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 161 of file ServiceManager.h.
|
mutableprivate |
Definition at line 188 of file ServiceManager.h.
|
private |
Check for service initialization loops.
Definition at line 176 of file ServiceManager.h.
|
private |
Map of service name and service type.
Definition at line 175 of file ServiceManager.h.