Gaudi Framework, version v20r2

Generated: 18 Jul 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
 Return the list of 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.

References IID_ISvcLocator.

Referenced by ApplicationMgr::queryInterface().

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.

Referenced by MultiStoreSvc::create(), Sequencer::createAndAppend(), ServiceLocatorHelper::createService(), Algorithm::createSubAlgorithm(), OutputStream::decodeAlgorithms(), Sequencer::decodeNames(), Gaudi::BootSvcLocator::getService(), RootHistCnv::RNTupleCnv::initialize(), RndmGenSvc::initialize(), EventSelectorDataStream::initialize(), DLLClassManager::loadModule(), ServiceLocatorHelper::locateService(), AlgorithmManager::msgSvc(), service(), Auditor::service(), GaudiPython::Helper::service(), Algorithm::setProperties(), and Auditor::sysInitialize().

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]

Return the list of Services.

Implemented in Gaudi::BootSvcLocator, and ServiceManager.

Referenced by HistorySvc::captureState(), and Gaudi::BootSvcLocator::getServices().

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.

Referenced by Gaudi::BootSvcLocator::existsService().

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.

References getService(), StatusCode::isSuccess(), name, and Gaudi::Units::s.

Referenced by AlgTool::AlgTool(), ApplicationMgr::configure(), OutputStream::connectConversionSvc(), ServiceManager::createService(), ApplicationMgr::finalize(), ApplicationMgr::i_startup(), IssueSeverity::init(), Gaudi::IODataManager::initialize(), VFSSvc::initialize(), RndmEngine::initialize(), OutputStream::initialize(), EvtCollectionStream::initialize(), EventSelector::initialize(), EventCollectionSelector::initialize(), EvtDataSvc::initialize(), EventLoopMgr::initialize(), PoolDbEvtSelector::initialize(), MinimalEventLoopMgr::initialize(), EventSelectorDataStream::initialize(), DataStreamTool::initialize(), Converter::initialize(), GslSvc::initialize(), DLLClassManager::loadModule(), MemStatAuditor::MemStatAuditor(), ServiceHandle< IToolSvc >::messageSvc(), Service::msgSvc(), Converter::msgSvc(), Algorithm::msgSvc(), EventLoopMgr::reinitialize(), Service::Service(), service(), Service::setProperties(), and AlgTool::setProperties().

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.

References ISvcManager::declareSvcType(), StatusCode::ignore(), name, and service().

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 Fri Jul 18 12:08:29 2008 for Gaudi Framework, version v20r2 by Doxygen version 1.5.1 written by Dimitri van Heesch, © 1997-2004