The Gaudi Framework  v29r0 (ff2e7097)
Gaudi::BootSvcLocator Class Reference

A dual-stage boostrap mechanism is used to ensure an orderly startup of the ApplicationMgr. More...

Inheritance diagram for Gaudi::BootSvcLocator:
Collaboration diagram for Gaudi::BootSvcLocator:

Public Member Functions

 BootSvcLocator ()=default
 
 ~BootSvcLocator () override=default
 
StatusCode getService (const Gaudi::Utils::TypeNameString &typeName, const InterfaceID &iid, IInterface *&pinterface) override
 
StatusCode getService (const Gaudi::Utils::TypeNameString &typeName, IService *&svc, const bool createIf=true) override
 
const std::list< IService * > & getServices () const override
 
bool existsService (const std::string &name) const override
 
SmartIF< IService > & service (const Gaudi::Utils::TypeNameString &typeName, const bool createIf=true) override
 Returns a smart pointer to a service. More...
 
- Public Member Functions inherited from implements< 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::stringgetInterfaceNames () const override
 Implementation of IInterface::getInterfaceNames. More...
 
 implements ()=default
 Default constructor. More...
 
 implements (const implements &)
 Copy constructor (zero the reference count) More...
 
implementsoperator= (const implements &)
 Assignment operator (do not touch the reference count). More...
 
 ~implements () override=default
 Virtual destructor. More...
 
unsigned long addRef () override
 Reference Interface instance. More...
 
unsigned long release () override
 Release Interface instance. More...
 
unsigned long refCount () const override
 Current reference count. More...
 
- Public Member Functions inherited from extend_interfaces< Interfaces... >
 ~extend_interfaces () override=default
 Virtual destructor. More...
 

Additional Inherited Members

- Public Types inherited from implements< ISvcLocator >
using base_class = implements< Interfaces... >
 Typedef to this class. More...
 
using extend_interfaces_base = extend_interfaces< Interfaces... >
 Typedef to the base of this class. More...
 
using iids = typename extend_interfaces_base::ext_iids
 
- 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...
 
- Protected Attributes inherited from implements< ISvcLocator >
std::atomic_ulong m_refCount
 Reference counter. More...
 

Detailed Description

A dual-stage boostrap mechanism is used to ensure an orderly startup of the ApplicationMgr.

If this function is called before the singleton ApplicationMgr instance exists, a BootstrapAppMgr singleton instance is created. This responds to any subsequent requests for services by returning StatusCode::FAILURE, unless the ApplicationMgr singleton instance has been created in the interim. In this case, the BootstrapAppMgr forwards the request to the ApplicationMgr instance. The motivation for this is to handle static object instances where the constructor attempts to locate services and would otherwise instantiate the ApplicationMgr instance in an unorderly manner. This logic requires that the ApplicationMgr instance is created explicitly.

Definition at line 40 of file Bootstrap.cpp.

Constructor & Destructor Documentation

Gaudi::BootSvcLocator::BootSvcLocator ( )
default
Gaudi::BootSvcLocator::~BootSvcLocator ( )
overridedefault

Member Function Documentation

bool Gaudi::BootSvcLocator::existsService ( const std::string name) const
override

Definition at line 224 of file Bootstrap.cpp.

225 {
226  return s_appmgrInstance && s_svclocInstance->existsService( name );
227 }
virtual bool existsService(const std::string &name) const =0
Check the existence of a service given a service name.
StatusCode Gaudi::BootSvcLocator::getService ( const Gaudi::Utils::TypeNameString typeName,
const InterfaceID iid,
IInterface *&  pinterface 
)
override

Definition at line 196 of file Bootstrap.cpp.

198 {
200  if ( s_appmgrInstance ) {
201  sc = s_svclocInstance->getService( typeName, iid, pinterface );
202  } else {
203  pinterface = s_bootInterface.get();
204  }
205  return sc;
206 }
TYPE * get() const
Get interface pointer.
Definition: SmartIF.h:82
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:28
virtual StatusCode getService(const Gaudi::Utils::TypeNameString &typeName, IService *&svc, const bool createIf=true)
Get a reference to the service given a service name.
Definition: ISvcLocator.h:36
StatusCode Gaudi::BootSvcLocator::getService ( const Gaudi::Utils::TypeNameString typeName,
IService *&  svc,
const bool  createIf = true 
)
override

Definition at line 207 of file Bootstrap.cpp.

209 {
211  if ( s_appmgrInstance ) {
212  sc = s_svclocInstance->getService( typeName, svc, createIf );
213  } else {
214  svc = s_bootService.get();
215  }
216  return sc;
217 }
TYPE * get() const
Get interface pointer.
Definition: SmartIF.h:82
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:28
virtual StatusCode getService(const Gaudi::Utils::TypeNameString &typeName, IService *&svc, const bool createIf=true)
Get a reference to the service given a service name.
Definition: ISvcLocator.h:36
const std::list< IService * > & Gaudi::BootSvcLocator::getServices ( ) const
override

Definition at line 220 of file Bootstrap.cpp.

221 {
222  return s_appmgrInstance ? s_svclocInstance->getServices() : s_bootServices;
223 }
virtual const std::list< IService * > & getServices() const =0
Get a reference to a service and create it if it does not exists.
SmartIF< IService > & Gaudi::BootSvcLocator::service ( const Gaudi::Utils::TypeNameString typeName,
const bool  createIf = true 
)
override

Returns a smart pointer to a service.

Definition at line 229 of file Bootstrap.cpp.

230 {
231  return s_appmgrInstance ? s_svclocInstance->service( typeName, createIf ) : s_bootService;
232 }
StatusCode service(const Gaudi::Utils::TypeNameString &name, T *&svc, bool createIf=true)
Templated method to access a service by name.
Definition: ISvcLocator.h:79

The documentation for this class was generated from the following file: