![]() |
|
|
Generated: 24 Nov 2008 |
#include <GaudiKernel/ISvcLocator.h>


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.
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 InterfaceID & | interfaceID () |
| Retrieve interface ID. | |
| 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 |
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.
| 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.
| 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.
| 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 = 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 }