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 ()
 
virtual ~BootSvcLocator ()
 
virtual StatusCode getService (const Gaudi::Utils::TypeNameString &typeName, const InterfaceID &iid, IInterface *&pinterface)
 Get a specific interface pointer given a service name and interface id. More...
 
virtual StatusCode getService (const Gaudi::Utils::TypeNameString &typeName, IService *&svc, const bool createIf=true)
 Get a reference to the service given a service name. More...
 
virtual const std::list< IService * > & getServices () const
 Get a reference to a service and create it if it does not exists. More...
 
virtual bool existsService (const std::string &name) const
 Check the existence of a service given a service name. More...
 
virtual SmartIF< IService > & service (const Gaudi::Utils::TypeNameString &typeName, const bool createIf=true)
 Returns a smart pointer to a service. More...
 
- Public Member Functions inherited from extend_interfaces1< ISvcLocator >
virtual ~extend_interfaces1 ()
 Virtual destructor. More...
 
virtual ~extend_interfaces1 ()
 Virtual destructor. More...
 
- Public Member Functions inherited from ISvcLocator
 DeclareInterfaceID (ISvcLocator, 3, 0)
 InterfaceID. More...
 
template<class T >
StatusCode service (const Gaudi::Utils::TypeNameString &name, T *&svc, bool createIf=true)
 Templated method to access a service by name. More...
 
template<class T >
StatusCode service (const std::string &type, const std::string &name, T *&svc, bool createIf=true)
 Templated method to access a service by type and name. 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...
 
 DeclareInterfaceID (ISvcLocator, 3, 0)
 InterfaceID. More...
 
template<class T >
StatusCode service (const Gaudi::Utils::TypeNameString &name, T *&svc, bool createIf=true)
 Templated method to access a service by name. More...
 
template<class T >
StatusCode service (const std::string &type, const std::string &name, T *&svc, bool createIf=true)
 Templated method to access a service by type and name. 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...
 
- Public Member Functions inherited from IInterface
virtual void * i_cast (const InterfaceID &) const =0
 main cast function More...
 
virtual std::vector< std::string > getInterfaceNames () const =0
 Returns a vector of strings containing the names of all the implemented interfaces. More...
 
virtual unsigned long addRef ()=0
 Increment the reference count of Interface instance. More...
 
virtual unsigned long release ()=0
 Release Interface instance. More...
 
virtual unsigned long refCount () const =0
 Current reference count. More...
 
virtual StatusCode queryInterface (const InterfaceID &ti, void **pp)=0
 Set the void** to the pointer to the requested interface of the instance. More...
 
virtual ~IInterface ()
 Virtual destructor. More...
 
virtual void * i_cast (const InterfaceID &) const =0
 main cast function More...
 
virtual std::vector< std::string > getInterfaceNames () const =0
 Returns a vector of strings containing the names of all the implemented interfaces. More...
 
virtual unsigned long addRef ()=0
 Increment the reference count of Interface instance. More...
 
virtual unsigned long release ()=0
 Release Interface instance. More...
 
virtual unsigned long refCount () const =0
 Current reference count. More...
 
virtual StatusCode queryInterface (const InterfaceID &ti, void **pp)=0
 Set the void** to the pointer to the requested interface of the instance. More...
 
virtual ~IInterface ()
 Virtual destructor. More...
 

Additional Inherited Members

- Public Types inherited from implements1< ISvcLocator >
typedef implements1 base_class
 Typedef to this class. More...
 
typedef implements1 base_class
 Typedef to this class. More...
 
typedef extend_interfaces1< ISvcLocatorextend_interfaces_base
 Typedef to the base of this class. More...
 
typedef extend_interfaces1< ISvcLocatorextend_interfaces_base
 Typedef to the base of this class. More...
 
typedef extend_interfaces_base::ext_iids interfaces
 MPL set of all the implemented interfaces. More...
 
typedef extend_interfaces_base::ext_iids interfaces
 MPL set of all the implemented interfaces. More...
 
- Public Types inherited from extend_interfaces1< ISvcLocator >
typedef ISvcLocator::iid::iids::type ext_iids
 MPL set of interfaces extended by this one. More...
 
typedef ISvcLocator::iid::iids::type ext_iids
 MPL set of interfaces extended by this one. More...
 
- Public Types inherited from IInterface
enum  Status {
  SUCCESS = 1, NO_INTERFACE, VERSMISMATCH, LAST_ERROR,
  SUCCESS = 1, NO_INTERFACE, VERSMISMATCH, LAST_ERROR
}
 Return status. More...
 
enum  Status {
  SUCCESS = 1, NO_INTERFACE, VERSMISMATCH, LAST_ERROR,
  SUCCESS = 1, NO_INTERFACE, VERSMISMATCH, LAST_ERROR
}
 Return status. More...
 
typedef Gaudi::InterfaceId< IInterface, 0, 0 > iid
 Interface ID. More...
 
typedef mpl::set1< iidext_iids
 Extra interfaces. More...
 
typedef Gaudi::InterfaceId< IInterface, 0, 0 > iid
 Interface ID. More...
 
typedef mpl::set1< iidext_iids
 Extra interfaces. More...
 
- Static Public Member Functions inherited from IInterface
static const InterfaceIDinterfaceID ()
 Return an instance of InterfaceID identifying the interface. More...
 
static const InterfaceIDinterfaceID ()
 Return an instance of InterfaceID identifying the interface. 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

BootSvcLocator::BootSvcLocator ( )

Definition at line 218 of file Bootstrap.cpp.

218  {
219 }
BootSvcLocator::~BootSvcLocator ( )
virtual

Definition at line 220 of file Bootstrap.cpp.

220  {
221 }

Member Function Documentation

bool Gaudi::BootSvcLocator::existsService ( const std::string &  name) const
virtual

Check the existence of a service given a service name.

Implements ISvcLocator.

Definition at line 256 of file Bootstrap.cpp.

256  {
257  bool result = false;
258  if ( s_appmgrInstance.isValid() ) {
259  result = s_svclocInstance->existsService(name);
260  }
261  return result;
262 }
bool isValid() const
Allow for check if smart pointer is valid.
Definition: SmartIF.h:51
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 
)
virtual

Get a specific interface pointer given a service name and interface id.

Parameters
nameService name
iidInterface ID
pinterfaceReturned pointer to the requested interface

Reimplemented from ISvcLocator.

Definition at line 224 of file Bootstrap.cpp.

226  {
228  if ( s_appmgrInstance.isValid() ) {
229  sc = s_svclocInstance->getService(typeName, iid, pinterface );
230  } else {
231  pinterface = s_bootInterface.get();
232  }
233  return sc;
234 }
TYPE * get() const
Get interface pointer.
Definition: SmartIF.h:62
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:30
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
bool isValid() const
Allow for check if smart pointer is valid.
Definition: SmartIF.h:51
StatusCode Gaudi::BootSvcLocator::getService ( const Gaudi::Utils::TypeNameString typeName,
IService *&  svc,
const bool  createIf = true 
)
virtual

Get a reference to the service given a service name.

Parameters
nameService name
svcReturned service pointer

Reimplemented from ISvcLocator.

Definition at line 235 of file Bootstrap.cpp.

237  {
239  if ( s_appmgrInstance.isValid() ) {
240  sc = s_svclocInstance->getService(typeName, svc, createIf );
241  } else {
242  svc = s_bootService.get();
243  }
244  return sc;
245 }
TYPE * get() const
Get interface pointer.
Definition: SmartIF.h:62
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:30
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
bool isValid() const
Allow for check if smart pointer is valid.
Definition: SmartIF.h:51
const std::list< IService * > & Gaudi::BootSvcLocator::getServices ( ) const
virtual

Get a reference to a service and create it if it does not exists.

Parameters
nameService name
svcReturned service pointer
createIfflag to control the creationReturn the list of Services

Implements ISvcLocator.

Definition at line 248 of file Bootstrap.cpp.

248  {
250  if ( s_appmgrInstance.isValid() ) {
251  return s_svclocInstance->getServices( );
252  } else {
253  return s_bootServices;
254  }
255 }
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:30
bool isValid() const
Allow for check if smart pointer is valid.
Definition: SmartIF.h:51
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 
)
virtual

Returns a smart pointer to a service.

Implements ISvcLocator.

Definition at line 265 of file Bootstrap.cpp.

265  {
266  if ( s_appmgrInstance.isValid() ) {
267  return s_svclocInstance->service(typeName, createIf);
268  } else {
269  return s_bootService;
270  }
271 }
StatusCode service(const Gaudi::Utils::TypeNameString &name, T *&svc, bool createIf=true)
Templated method to access a service by name.
Definition: ISvcLocator.h:82
bool isValid() const
Allow for check if smart pointer is valid.
Definition: SmartIF.h:51

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