an helper to share the implementation of service() among the various kernel base classes
More...
#include </builds/gaudi/Gaudi/GaudiKernel/include/GaudiKernel/ServiceLocatorHelper.h>
an helper to share the implementation of service() among the various kernel base classes
Definition at line 26 of file ServiceLocatorHelper.h.
◆ ServiceLocatorHelper() [1/3]
Definition at line 28 of file ServiceLocatorHelper.h.
30 ,
m_msgLog( SmartIF<IMessageSvc>( &svcLoc ), requester.
name() )
31 ,
virtual const std::string & name() const =0
Retrieve the name of the instance.
std::string m_requesterName
◆ ServiceLocatorHelper() [2/3]
ServiceLocatorHelper::ServiceLocatorHelper |
( |
ISvcLocator & | svcLoc, |
|
|
std::string | loggedName, |
|
|
std::string | requesterName ) |
|
inline |
Definition at line 33 of file ServiceLocatorHelper.h.
35 ,
m_msgLog( SmartIF<IMessageSvc>( &svcLoc ), std::move( loggedName ) )
36 ,
const std::string & requesterName() const
◆ ServiceLocatorHelper() [3/3]
ServiceLocatorHelper::ServiceLocatorHelper |
( |
ISvcLocator & | svcLoc, |
|
|
std::string | requesterName ) |
|
inline |
◆ log()
MsgStream & ServiceLocatorHelper::log |
( |
| ) |
const |
|
inlineprivate |
◆ requesterName()
const std::string & ServiceLocatorHelper::requesterName |
( |
| ) |
const |
|
inlineprivate |
◆ service() [1/2]
SmartIF< IService > ServiceLocatorHelper::service |
( |
std::string_view | name, |
|
|
const bool | quiet = false, |
|
|
const bool | createIf = true ) const |
Definition at line 14 of file ServiceLocatorHelper.cpp.
14 {
16
17 if ( theSvc ) {
18 if ( !quiet ) {
21 }
22 } else {
23
24 if ( !quiet ) {
log() <<
MSG::ERROR <<
"ServiceLocatorHelper::service: can not locate service " <<
name <<
endmsg; }
25 }
26 return theSvc;
27}
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
virtual SmartIF< IService > & service(const Gaudi::Utils::TypeNameString &typeName, const bool createIf=true)=0
Returns a smart pointer to a service.
ISvcLocator * serviceLocator() const
◆ service() [2/2]
template<typename T>
SmartIF< T > ServiceLocatorHelper::service |
( |
std::string_view | name, |
|
|
const bool | quiet = false, |
|
|
const bool | createIf = true ) const |
|
inline |
Definition at line 47 of file ServiceLocatorHelper.h.
47 {
48 return service( name, quiet, createIf ).
as<T>();
49 }
SmartIF< IService > service(std::string_view name, const bool quiet=false, const bool createIf=true) const
SmartIF< IFace > as() const
return a new SmartIF instance to another interface
◆ serviceLocator()
ISvcLocator * ServiceLocatorHelper::serviceLocator |
( |
| ) |
const |
|
inlineprivate |
◆ m_msgLog
◆ m_requesterName
std::string ServiceLocatorHelper::m_requesterName |
|
private |
◆ m_svcLoc
The documentation for this class was generated from the following files: