|
Gaudi Framework, version v21r9 |
| Home | Generated: 3 May 2010 |
#include <GaudiKernel/ISvcLocator.h>


Public Member Functions | |
| DeclareInterfaceID (ISvcLocator, 3, 0) | |
| InterfaceID. | |
| 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 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 const std::list < IService * > & | getServices () const =0 |
| Get a reference to a service and create it if it does not exists. | |
| virtual bool | existsService (const std::string &name) const =0 |
| Check the existence of a service given a service name. | |
| template<class T> | |
| StatusCode | service (const Gaudi::Utils::TypeNameString &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 SmartIF< IService > & | service (const Gaudi::Utils::TypeNameString &typeName, const bool createIf=true)=0 |
| Returns a smart pointer to a service. | |
| template<typename T> | |
| SmartIF< T > | service (const Gaudi::Utils::TypeNameString &typeName, const bool createIf=true) |
| Returns a smart pointer to the requested interface of a service. | |
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 26 of file ISvcLocator.h.
| ISvcLocator::DeclareInterfaceID | ( | ISvcLocator | , | |
| 3 | , | |||
| 0 | ||||
| ) |
| virtual StatusCode ISvcLocator::getService | ( | const Gaudi::Utils::TypeNameString & | typeName, | |
| IService *& | svc, | |||
| const bool | createIf = true | |||
| ) | [inline, virtual] |
Get a reference to the service given a service name.
| name | Service name | |
| svc | Returned service pointer |
Reimplemented in Gaudi::BootSvcLocator.
Definition at line 36 of file ISvcLocator.h.
00037 { 00038 SmartIF<IService> &s = service(typeName, createIf); 00039 svc = s.get(); 00040 if (svc) { 00041 svc->addRef(); // Needed to maintain the correct reference counting. 00042 return StatusCode::SUCCESS; 00043 } 00044 return StatusCode::FAILURE; 00045 }
| virtual StatusCode ISvcLocator::getService | ( | const Gaudi::Utils::TypeNameString & | typeName, | |
| const InterfaceID & | iid, | |||
| IInterface *& | pinterface | |||
| ) | [inline, 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 |
Reimplemented in Gaudi::BootSvcLocator.
Definition at line 52 of file ISvcLocator.h.
00054 { 00055 SmartIF<IService> svc = service(typeName, false); 00056 if (svc.isValid()) { 00057 // Service found. So now get the right interface 00058 return svc->queryInterface(iid, (void**)&pinterface); 00059 } 00060 return StatusCode::FAILURE; 00061 }
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 Return the list of Services |
Implemented in Gaudi::BootSvcLocator.
| virtual bool ISvcLocator::existsService | ( | const std::string & | name | ) | const [pure virtual] |
| StatusCode ISvcLocator::service | ( | const Gaudi::Utils::TypeNameString & | name, | |
| T *& | svc, | |||
| bool | createIf = true | |||
| ) | [inline] |
Templated method to access a service by name.
Definition at line 82 of file ISvcLocator.h.
00082 { 00083 if( createIf ) { 00084 IService* s; 00085 StatusCode sc = getService( name, s, true); 00086 if ( !sc.isSuccess() ) return sc; // Must check if initialization was OK! 00087 } 00088 return getService( name, T::interfaceID(), (IInterface*&)svc ); 00089 }
| StatusCode ISvcLocator::service | ( | const std::string & | type, | |
| const std::string & | name, | |||
| T *& | svc, | |||
| bool | createIf = true | |||
| ) | [inline] |
| SmartIF<T> ISvcLocator::service | ( | const Gaudi::Utils::TypeNameString & | typeName, | |
| const bool | createIf = true | |||
| ) | [inline] |
Returns a smart pointer to the requested interface of a service.
Reimplemented in Gaudi::BootSvcLocator.
Definition at line 104 of file ISvcLocator.h.
00104 { 00105 return SmartIF<T>(service(typeName, createIf)); 00106 }