Gaudi Framework, version v20r3

Generated: 24 Nov 2008

ISvcLocator Class Reference

#include <GaudiKernel/ISvcLocator.h>

Inheritance diagram for ISvcLocator:

Inheritance graph
[legend]
Collaboration diagram for ISvcLocator:

Collaboration graph
[legend]

List of all members.


Detailed Description

The ISvcLocator is the interface implemented by the Service Factory in the Application Manager to locate services in the framework.

Clients use this interface to locate references to interfaces of services existing in the application. This operation needs to be done before the service can be used by the client. Typically "locating the services" is done at the initialization phase of the clients.

Author:
Pere Mato

Definition at line 27 of file ISvcLocator.h.


Public Member Functions

virtual StatusCode getService (const std::string &name, IService *&svc)=0
 Get a reference to the service given a service name.
virtual StatusCode getService (const std::string &name, const InterfaceID &iid, IInterface *&pinterface)=0
 Get a specific interface pointer given a service name and interface id.
virtual StatusCode getService (const std::string &name, IService *&svc, bool createIf)=0
 Get a reference to a service and create it if it does not exists.
virtual const std::list
< IService * > & 
getServices () const =0
 Erase service from the list of known services.
virtual bool existsService (const std::string &name) const =0
 Check the existance of a service given a service name.
template<class T>
StatusCode service (const std::string &name, T *&svc, bool createIf=true)
 Templated method to access a service by name.
template<class T>
StatusCode service (const std::string &type, const std::string &name, T *&svc, bool createIf=false)
 Templated method to access a service by type and name.

Static Public Member Functions

static const InterfaceIDinterfaceID ()
 Retrieve interface ID.

Member Function Documentation

static const InterfaceID& ISvcLocator::interfaceID (  )  [inline, static]

Retrieve interface ID.

Reimplemented from IInterface.

Definition at line 30 of file ISvcLocator.h.

00030 { return IID_ISvcLocator; }

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

Get a reference to the service given a service name.

Parameters:
name Service name
svc Returned service pointer

Implemented in Gaudi::BootSvcLocator, and ServiceManager.

virtual StatusCode ISvcLocator::getService ( const std::string &  name,
const InterfaceID iid,
IInterface *&  pinterface 
) [pure 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

Implemented in Gaudi::BootSvcLocator, and ServiceManager.

virtual StatusCode ISvcLocator::getService ( const std::string &  name,
IService *&  svc,
bool  createIf 
) [pure 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

Implemented in Gaudi::BootSvcLocator, and ServiceManager.

virtual const std::list<IService*>& ISvcLocator::getServices (  )  const [pure virtual]

Erase service from the list of known services.

Return the list of Services

Implemented in Gaudi::BootSvcLocator, and ServiceManager.

virtual bool ISvcLocator::existsService ( const std::string &  name  )  const [pure virtual]

Check the existance of a service given a service name.

Implemented in Gaudi::BootSvcLocator, and ServiceManager.

template<class T>
StatusCode ISvcLocator::service ( const std::string &  name,
T *&  svc,
bool  createIf = true 
) [inline]

Templated method to access a service by name.

Definition at line 66 of file ISvcLocator.h.

00066                                                                              {
00067     if( createIf ) {
00068       IService* s;
00069       StatusCode sc = getService( name, s, true);
00070       if ( !sc.isSuccess() ) return sc;  // Must check if initialization was OK!
00071     }
00072     return getService( name, T::interfaceID(), (IInterface*&)svc );
00073   }

template<class T>
StatusCode ISvcLocator::service ( const std::string &  type,
const std::string &  name,
T *&  svc,
bool  createIf = false 
) [inline]

Templated method to access a service by type and name.

Definition at line 77 of file ISvcLocator.h.

00078                                                        {
00079     try {
00080       ISvcManager& theManager = dynamic_cast<ISvcManager&>(*this);
00081       theManager.declareSvcType(name, type).ignore();
00082     } catch(...) {}
00083     //even if the above fails we may still find the service, so keep going
00084     return service(name, svc, createIf);
00085   }


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

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