| # Gaudi Framework, version v20r2
Generated: 18 Jul 2008

- Main Page
- Namespaces
- Classes
- Files
- Directories
- Related Pages

- Search for |

- Alphabetical List
- Class List
- Class Hierarchy
- Class Members

# Gaudi::BootSvcLocator Class Reference

Inheritance diagram for Gaudi::BootSvcLocator:

[legend]
Collaboration diagram for Gaudi::BootSvcLocator:

[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
| Return the list of 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.

References m_refcount.

    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.

References m_refcount.

Referenced by queryInterface().

    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.

References count(), and m_refcount.

    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.

References addRef(), StatusCode::FAILURE, IID_IInterface, IID_ISvcLocator, queryInterface(), and StatusCode::SUCCESS.

Referenced by queryInterface().

    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.

References StatusCode::FAILURE, ISvcLocator::getService(), getService(), name, s_appmgrInstance, s_bootService, and s_svclocInstance.

Referenced by getService().

    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.

References StatusCode::FAILURE, ISvcLocator::getService(), getService(), name, s_appmgrInstance, s_bootInterface, and s_svclocInstance.

    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.

References StatusCode::FAILURE, ISvcLocator::getService(), getService(), name, s_appmgrInstance, s_bootService, and s_svclocInstance.

    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]`

Return the list of Services.

Implements ISvcLocator.

Definition at line 324 of file Bootstrap.cpp.

References StatusCode::FAILURE, ISvcLocator::getServices(), getServices(), s_appmgrInstance, s_bootServices, and s_svclocInstance.

Referenced by getServices().

    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.

References ISvcLocator::existsService(), existsService(), name, s_appmgrInstance, and s_svclocInstance.

Referenced by existsService().

    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.

Referenced by addRef(), BootSvcLocator(), and release().

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

- /afs/cern.ch/sw/Gaudi/releases/GAUDI/GAUDI_v20r2/GaudiKernel/v25r2/src/Lib/Bootstrap.cpp