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


Public Member Functions | |
| ServiceHandle (const std::string &serviceName, const std::string &theParentName) | |
| Create a handle ('smart pointer') to a service. | |
| StatusCode | retrieve () const |
| Retrieve the Service. | |
Protected Member Functions | |
| StatusCode | retrieve (T *&service) const |
| Release the Service. | |
Private Member Functions | |
| SmartIF< ISvcLocator > & | serviceLocator () const |
| Do the real release of the Service. | |
| SmartIF< IMessageSvc > & | messageSvc () const |
Private Attributes | |
| SmartIF< ISvcLocator > | m_pSvcLocator |
| SmartIF< IMessageSvc > | m_pMessageSvc |
This allows better control through the framework of service loading and usage.
Definition at line 30 of file ServiceHandle.h.
| ServiceHandle< T >::ServiceHandle | ( | const std::string & | serviceName, | |
| const std::string & | theParentName | |||
| ) | [inline] |
Create a handle ('smart pointer') to a service.
The arguments are passed on to ServiceSvc, and have the same meaning:
| serviceName | name of the service | |
| parentName | name of the parent Algorithm, AlgTool or Service. It is used for log printout at retrieve(), and for retrieving a thread-dependent service (if applicable) |
Definition at line 42 of file ServiceHandle.h.
00043 : GaudiHandle<T>(serviceName, "Service", theParentName) 00044 {}
| StatusCode ServiceHandle< T >::retrieve | ( | ) | const [inline] |
Retrieve the Service.
Release existing Service if needed. Function must be repeated here to avoid hiding the function retrieve( T*& )
Reimplemented from GaudiHandle< T >.
Definition at line 48 of file ServiceHandle.h.
00048 { // not really const, because it updates m_pObject 00049 return GaudiHandle<T>::retrieve(); 00050 }
| StatusCode ServiceHandle< T >::retrieve | ( | T *& | service | ) | const [inline, protected, virtual] |
Release the Service.
Function must be repeated here to avoid hiding the function release( T*& ) Do the real retrieval of the Service.
Implements GaudiHandle< T >.
Definition at line 60 of file ServiceHandle.h.
00060 { 00061 const ServiceLocatorHelper helper(*serviceLocator(), GaudiHandleBase::messageName(), this->parentName()); 00062 return helper.getService(GaudiHandleBase::typeAndName(), true, T::interfaceID(), (void**)&service); 00063 }
| SmartIF<ISvcLocator>& ServiceHandle< T >::serviceLocator | ( | ) | const [inline, private] |
Do the real release of the Service.
Definition at line 74 of file ServiceHandle.h.
00074 { // not really const, because it may change m_pSvcLocator 00075 if ( !m_pSvcLocator.isValid() ) { 00076 m_pSvcLocator = Gaudi::svcLocator(); 00077 if ( !m_pSvcLocator.isValid() ) { 00078 throw GaudiException("SvcLocator not found", "Core component not found", StatusCode::FAILURE); 00079 } 00080 } 00081 return m_pSvcLocator; 00082 }
| SmartIF<IMessageSvc>& ServiceHandle< T >::messageSvc | ( | ) | const [inline, private] |
Definition at line 84 of file ServiceHandle.h.
00084 { // not really const, because it may change m_pMessageSvc 00085 if ( !m_pMessageSvc.isValid() ) { 00086 m_pMessageSvc = serviceLocator(); // default message service 00087 if( !m_pMessageSvc.isValid() ) { 00088 throw GaudiException("Service [MessageSvc] not found", 00089 this->parentName(), StatusCode::FAILURE); 00090 } 00091 } 00092 return m_pMessageSvc; 00093 }
SmartIF<ISvcLocator> ServiceHandle< T >::m_pSvcLocator [mutable, private] |
Definition at line 97 of file ServiceHandle.h.
SmartIF<IMessageSvc> ServiceHandle< T >::m_pMessageSvc [mutable, private] |
Definition at line 98 of file ServiceHandle.h.