| # Gaudi Framework, version v21r7p1 |

Home |  | Generated: 15 Feb 2010

# 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:

[legend]
Collaboration diagram for Gaudi::BootSvcLocator:

[legend]

List of all members.

## 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.
virtual StatusCode | getService (const Gaudi::Utils::TypeNameString &typeName, IService *&svc, const bool createIf=true)
| Get a reference to the service given a service name.
virtual const std::list < IService * > & | getServices () const
| Get a reference to a service and create it if it does not exists.
virtual bool | existsService (const std::string &name) const
| Check the existence of a service given a service name.
virtual SmartIF< IService > & | service (const Gaudi::Utils::TypeNameString &typeName, const bool createIf=true)
| Returns a smart pointer to a service.

## 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.

## Constructor & Destructor Documentation

BootSvcLocator::BootSvcLocator | ( |  | ) |

Definition at line 237 of file Bootstrap.cpp.

    00237                                {
    00238 }

BootSvcLocator::~BootSvcLocator | ( |  | ) | `[virtual]`

Definition at line 239 of file Bootstrap.cpp.

    00239                                 {
    00240 }

## Member Function Documentation

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:

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

Reimplemented from ISvcLocator.

Definition at line 243 of file Bootstrap.cpp.

    00245                                                                  {
    00246   StatusCode sc = StatusCode::FAILURE;
    00247   if ( s_appmgrInstance.isValid() ) {
    00248     sc = s_svclocInstance->getService(typeName, iid, pinterface );
    00249   } else {
    00250     pinterface = s_bootInterface.get();
    00251   }
    00252   return sc;
    00253 }

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:

  | name | Service name
  | svc | Returned service pointer

Reimplemented from ISvcLocator.

Definition at line 254 of file Bootstrap.cpp.

    00256                                                              {
    00257   StatusCode sc = StatusCode::FAILURE;
    00258   if ( s_appmgrInstance.isValid() ) {
    00259     sc = s_svclocInstance->getService(typeName, svc, createIf );
    00260   } else {
    00261     svc = s_bootService.get();
    00262   }
    00263   return sc;
    00264 }

const std::list< IService * > & Gaudi::BootSvcLocator::getServices | ( |  | ) | const`[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 Return the list of Services

Implements ISvcLocator.

Definition at line 267 of file Bootstrap.cpp.

    00267                                                                   {
    00268   StatusCode sc = StatusCode::FAILURE;
    00269   if ( s_appmgrInstance.isValid() ) {
    00270     return s_svclocInstance->getServices( );
    00271   } else {
    00272     return s_bootServices;
    00273   }
    00274 }

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

    00275                                                                      {
    00276   bool result = false;
    00277   if ( s_appmgrInstance.isValid() ) {
    00278     result = s_svclocInstance->existsService(name);
    00279   }
    00280   return result;
    00281 }

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

    00284                                                                                                              {
    00285   if ( s_appmgrInstance.isValid() ) {
    00286     return s_svclocInstance->service(typeName, createIf);
    00287   } else {
    00288     return s_bootService;
    00289   }
    00290 }

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

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