1 #ifndef GAUDISVC_ServiceManager_H
2 #define GAUDISVC_ServiceManager_H
5 #include "GaudiKernel/Kernel.h"
6 #include "GaudiKernel/ISvcManager.h"
7 #include "GaudiKernel/ISvcLocator.h"
8 #include "GaudiKernel/IStateful.h"
9 #include "GaudiKernel/SmartIF.h"
10 #include "GaudiKernel/ComponentManager.h"
11 #include "GaudiKernel/Map.h"
45 return service->name() ==
name;
48 return service.
get() == ptr;
71 const std::list<IService*>&
getServices()
const override;
119 const std::string &
name()
const override {
120 static std::string _name =
"ServiceManager";
128 template <
typename T>
133 #if !defined(GAUDI_V22_API) || defined(G22_NEW_SVCLOCATOR)
140 inline ListSvc::iterator
find(
const std::string &
name) {
143 inline ListSvc::const_iterator
find(
const std::string &
name)
const {
186 #endif // GAUDISVC_ServiceManager_H
ListSvc::const_iterator find(const IService *ptr) const
The ServiceManager class is in charge of the creation of concrete instances of Services.
virtual StatusCode addService(IService *svc, int prio=DEFAULT_SVC_PRIORITY)=0
Add a service to the "active" list of services of the factory.
std::list< IService * > m_listOfPtrs
List of pointers to the know services used to implement getServices()
void setLoopCheckEnabled(bool en) override
Set the value of the initialization loop check flag.
SmartIF< IService > m_appSvc
Pointer to the application IService interface.
ListSvc::iterator find(const IService *ptr)
GaudiUtils::Map< InterfaceID, SmartIF< IInterface > > m_defaultImplementations
StatusCode finalize() override
Finalize (from INITIALIZED to CONFIGURED).
int getPriority(const std::string &name) const override
manage priorities of services
SmartIF< ISvcLocator > & serviceLocator() const override
Function needed by CommonMessaging.
bool m_loopCheck
Check for service initialization loops.
bool existsService(const std::string &name) const override
implementation of ISvcLocation::existsService
ServiceManager(IInterface *application)
default creator
StatusCode restart() override
Initialization (from RUNNING to RUNNING, via INITIALIZED).
MapType m_maptype
Map of service name and service type.
TYPE * get() const
Get interface pointer.
StatusCode stop() override
Stop (from RUNNING to INITIALIZED).
Helper class to parse a string of format "type/name".
std::recursive_mutex m_svcinitmutex
Mutex to synchronize shared service initialization between threads.
bool loopCheckEnabled() const override
Get the value of the initialization loop check flag.
General service interface definition.
SmartIF< T > service(const Gaudi::Utils::TypeNameString &typeName, const bool createIf=true)
Returns a smart pointer to the requested interface of a service.
This class is used for returning status codes from appropriate routines.
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...
Definition of the basic interface.
const std::list< IService * > & getServices() const override
Return the list of Services.
~ServiceManager() override
virtual destructor
The IMessage is the interface implemented by the message service.
const std::string & name() const override
Return the name of the manager (implementation of INamedInterface)
StatusCode start() override
Start (from INITIALIZED to RUNNING).
bool operator==(const std::string &name) const
Property base class allowing Property* collections to be "homogeneous".
Base class used to extend a class implementing other interfaces.
StatusCode reinitialize() override
Initialization (from INITIALIZED or RUNNING to INITIALIZED, via CONFIGURED).
GaudiUtils::Map< std::string, std::string > MapType
ListSvc::const_iterator find(const std::string &name) const
bool operator<(const ServiceItem &rhs) const
ListSvc::iterator find(const std::string &name)
StatusCode declareSvcType(const std::string &svcname, const std::string &svctype) override
implementation of ISvcManager::declareSvcType
StatusCode setPriority(const std::string &name, int pri) override
StatusCode removeService(IService *svc) override
implementation of ISvcManager::removeService
SmartIF< IService > & service(const Gaudi::Utils::TypeNameString &typeName, const bool createIf=true) override
Returns a smart pointer to a service.
std::string typeName(const std::type_info &typ)
std::list< ServiceItem > ListSvc
ListSvc m_listsvc
List of service maintained by ServiceManager This contains SmartIF for all services – and because...
SmartIF< IService > & createService(const Gaudi::Utils::TypeNameString &nametype) override
implementation of ISvcManager::createService NOTE: as this returns a &, we must guarantee that once c...
ServiceItem(IService *s, long p=0, bool act=false)
bool operator==(const IService *ptr) const
SmartIF< IService > service
StatusCode addService(IService *svc, int prio=DEFAULT_SVC_PRIORITY) override
implementation of ISvcManager::addService
StatusCode initialize() override
Initialization (from CONFIGURED to INITIALIZED).