#include <GaudiKernel/ISvcLocator.h>
Inheritance diagram for ISvcLocator:
Public Types | |
SUCCESS = 1 | |
Normal successful completion. | |
NO_INTERFACE | |
Requested interface is not available. | |
VERSMISMATCH | |
Requested interface version is incompatible. | |
LAST_ERROR | |
Last error. | |
enum | Status { SUCCESS = 1, NO_INTERFACE, VERSMISMATCH, LAST_ERROR } |
Return status. More... | |
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=true) |
Templated method to access a service by type and name. | |
virtual StatusCode | queryInterface (const InterfaceID &riid, void **ppvInterface)=0 |
Query interfaces of Interface. | |
virtual unsigned long | addRef ()=0 |
Increment the reference count of Interface instance. | |
virtual unsigned long | release ()=0 |
Release Interface instance. | |
Static Public Member Functions | |
static const InterfaceID & | interfaceID () |
Retrieve interface ID. |
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.
Definition at line 27 of file ISvcLocator.h.
enum IInterface::Status [inherited] |
Return status.
SUCCESS | Normal successful completion. |
NO_INTERFACE | Requested interface is not available. |
VERSMISMATCH | Requested interface version is incompatible. |
LAST_ERROR | Last error. |
Reimplemented in IConversionSvc, IConverter, and IDataProviderSvc.
Definition at line 113 of file IInterface.h.
00113 { 00115 SUCCESS = 1, 00117 NO_INTERFACE, 00119 VERSMISMATCH, 00121 LAST_ERROR 00122 };
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.
name | Service name | |
svc | Returned service pointer |
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.
name | Service name | |
iid | Interface ID | |
pinterface | Returned pointer to the requested interface |
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.
name | Service name | |
svc | Returned service pointer | |
createIf | flag to control the creation |
virtual const std::list<IService*>& ISvcLocator::getServices | ( | ) | const [pure virtual] |
Return the list of Services.
virtual bool ISvcLocator::existsService | ( | const std::string & | name | ) | const [pure virtual] |
Check the existance of a service given a service name.
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 }
StatusCode ISvcLocator::service | ( | const std::string & | type, | |
const std::string & | name, | |||
T *& | svc, | |||
bool | createIf = true | |||
) | [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 }
virtual StatusCode IInterface::queryInterface | ( | const InterfaceID & | riid, | |
void ** | ppvInterface | |||
) | [pure virtual, inherited] |
Query interfaces of Interface.
riid | ID of Interface to be retrieved | |
ppvInterface | Pointer to Location for interface pointer |
Implemented in Algorithm, AlgTool, Auditor, ConversionSvc, Converter, DataSvc, EventSelectorDataStream, MinimalEventLoopMgr, PropertyMgr, SelectStatement, and Service.
virtual unsigned long IInterface::addRef | ( | ) | [pure virtual, inherited] |
Increment the reference count of Interface instance.
Implemented in Algorithm, AlgTool, Auditor, Converter, EventSelectorDataStream, IFactory, PropertyMgr, SelectStatement, and Service.
virtual unsigned long IInterface::release | ( | ) | [pure virtual, inherited] |
Release Interface instance.
Implemented in Algorithm, AlgTool, Auditor, Converter, EventSelectorDataStream, IFactory, PropertyMgr, SelectStatement, and Service.