Gaudi Framework, version v20r3

Generated: 24 Nov 2008

Gaudi::BootSvcLocator Class Reference

Inheritance diagram for Gaudi::BootSvcLocator:

Inheritance graph
[legend]
Collaboration diagram for Gaudi::BootSvcLocator:

Collaboration graph
[legend]

List of all members.


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 motiviation 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 37 of file Bootstrap.cpp.


Public Member Functions

 BootSvcLocator ()
virtual ~BootSvcLocator ()
virtual unsigned long addRef ()
 implmentation of IInterface::addRef
virtual unsigned long release ()
 implmentation of IInterface::release
virtual StatusCode queryInterface (const InterfaceID &iid, void **pinterface)
 implementation of IInterface::queryInterface
virtual StatusCode getService (const std::string &name, IService *&svc)
 Get a reference to the service given a service name.
virtual StatusCode getService (const std::string &name, const InterfaceID &iid, IInterface *&pinterface)
 Get a specific interface pointer given a service name and interface id.
virtual StatusCode getService (const std::string &name, IService *&svc, bool createIf)
 Get a reference to a service and create it if it does not exists.
virtual const std::list
< IService * > & 
getServices () const
 Erase service from the list of known services.
virtual bool existsService (const std::string &name) const
 Check the existance of a service given a service name.

Private Attributes

unsigned long m_refcount
 Reference counter.

Constructor & Destructor Documentation

BootSvcLocator::BootSvcLocator (  ) 

Definition at line 262 of file Bootstrap.cpp.

00262                                {
00263   m_refcount = 0;
00264 }

BootSvcLocator::~BootSvcLocator (  )  [virtual]

Definition at line 265 of file Bootstrap.cpp.

00265                                 {
00266 }


Member Function Documentation

unsigned long BootSvcLocator::addRef (  )  [virtual]

implmentation of IInterface::addRef

Implements IInterface.

Definition at line 267 of file Bootstrap.cpp.

00267                                      {
00268   m_refcount++;
00269   return m_refcount;
00270 }

unsigned long BootSvcLocator::release (  )  [virtual]

implmentation of IInterface::release

Implements IInterface.

Definition at line 271 of file Bootstrap.cpp.

00271                                       {
00272   unsigned long count = --m_refcount;
00273   if( count <= 0) {
00274     delete this;
00275   }
00276   return count;
00277 }

StatusCode Gaudi::BootSvcLocator::queryInterface ( const InterfaceID iid,
void **  pinterface 
) [virtual]

implementation of IInterface::queryInterface

Implements IInterface.

Definition at line 278 of file Bootstrap.cpp.

00279 {
00280   if( iid == IID_IInterface ) {  
00281     *pinterface = (IInterface*)this;
00282     addRef();
00283     return StatusCode::SUCCESS;
00284   } 
00285   else if ( iid == IID_ISvcLocator ) {
00286     *pinterface = (ISvcLocator*)this;
00287     addRef();
00288     return StatusCode::SUCCESS;
00289   } 
00290   return StatusCode::FAILURE;
00291 }

StatusCode Gaudi::BootSvcLocator::getService ( const std::string &  name,
IService *&  svc 
) [virtual]

Get a reference to the service given a service name.

Parameters:
name Service name
svc Returned service pointer

Implements ISvcLocator.

Definition at line 292 of file Bootstrap.cpp.

00293                                                          {
00294   StatusCode sc = StatusCode::FAILURE;
00295   if ( 0 != s_appmgrInstance ) {
00296     sc = s_svclocInstance->getService(name, svc );
00297   } else {
00298     svc = s_bootService;
00299   }
00300   return sc;
00301 }

StatusCode Gaudi::BootSvcLocator::getService ( const std::string &  name,
const InterfaceID iid,
IInterface *&  pinterface 
) [virtual]

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

Parameters:
name Service name
iid Interface ID
pinterface Returned pointer to the requested interface

Implements ISvcLocator.

Definition at line 302 of file Bootstrap.cpp.

00304                                                                  {
00305   StatusCode sc = StatusCode::FAILURE;
00306   if ( 0 != s_appmgrInstance ) {
00307     sc = s_svclocInstance->getService(name, iid, pinterface );
00308   } else {
00309     pinterface = s_bootInterface;
00310   }
00311   return sc;
00312 }

StatusCode Gaudi::BootSvcLocator::getService ( const std::string &  name,
IService *&  svc,
bool  createIf 
) [virtual]

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

Parameters:
name Service name
svc Returned service pointer
createIf flag to control the creation

Implements ISvcLocator.

Definition at line 313 of file Bootstrap.cpp.

00315                                                        {
00316   StatusCode sc = StatusCode::FAILURE;
00317   if ( 0 != s_appmgrInstance ) {
00318     sc = s_svclocInstance->getService(name, svc, createIf );
00319   } else {
00320     svc = s_bootService;
00321   }
00322   return sc;
00323 }

const std::list< IService * > & Gaudi::BootSvcLocator::getServices (  )  const [virtual]

Erase service from the list of known services.

Return the list of Services

Implements ISvcLocator.

Definition at line 324 of file Bootstrap.cpp.

00324                                                                   {
00325   StatusCode sc = StatusCode::FAILURE;
00326   if ( 0 != s_appmgrInstance ) {
00327     return s_svclocInstance->getServices( );
00328   } else {
00329     return s_bootServices;
00330   }
00331 }

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

Check the existance of a service given a service name.

Implements ISvcLocator.

Definition at line 332 of file Bootstrap.cpp.

00332                                                                      {
00333   bool result = false;
00334   if ( 0 != s_appmgrInstance ) {
00335     result = s_svclocInstance->existsService(name );
00336   }
00337   return result;
00338 }


Member Data Documentation

unsigned long Gaudi::BootSvcLocator::m_refcount [private]

Reference counter.

Definition at line 58 of file Bootstrap.cpp.


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

Generated at Mon Nov 24 14:47:29 2008 for Gaudi Framework, version v20r3 by Doxygen version 1.5.6 written by Dimitri van Heesch, © 1997-2004