1 #ifndef GAUDIKERNEL_SERVICE_H
2 #define GAUDIKERNEL_SERVICE_H
48 const std::string&
name()
const override;
125 template <
class TYPE>
151 const_cast<T*
>(psvc)->addRef();
161 auto ptr = service<T>(
name,createIf);
162 psvc = ( ptr ? ptr.get() : nullptr );
170 template <
typename IFace = IService>
173 service<IFace>(
name, !createIf,
182 return service(svcType +
"/" + svcName, psvc);
215 (
const std::string& name ,
217 const std::string& doc =
"none" )
const
219 return m_propertyMgr -> declareProperty ( name , property , doc ) ;
231 (
const std::string& name ,
233 const std::string& rname =
"" )
const
235 return m_propertyMgr -> declareRemoteProperty ( name , rsvc , rname ) ;
247 "",
bool createIf =
true) {
249 if (toolTypeAndName ==
"")
256 debug() <<
"Handle for private tool" << toolTypeAndName
257 <<
" successfully created and stored." <<
endmsg;
260 error() <<
"Handle for private tool" << toolTypeAndName
261 <<
" could not be created." <<
endmsg;
277 "",
bool createIf =
true) {
279 if (toolTypeAndName ==
"")
287 debug() <<
"Handle for public tool" << toolTypeAndName
288 <<
" successfully created and stored." <<
endmsg;
291 error() <<
"Handle for public tool" << toolTypeAndName
292 <<
" could not be created." <<
endmsg;
320 void sysInitialize_imp();
345 void initOutputLevel(
Property& prop);
348 #ifndef GAUDI_NEW_PLUGIN_SERVICE
353 template <
typename S,
typename... Args>
355 return new T(std::forward<Args>(
args)...);
361 #define DECLARE_SERVICE_FACTORY(x) \
362 DECLARE_FACTORY_WITH_CREATOR(x, SvcFactory< x >, Service::Factory)
363 #define DECLARE_NAMED_SERVICE_FACTORY(x, n) \
364 DECLARE_FACTORY_WITH_CREATOR_AND_ID(x, SvcFactory< x >, #n, Service::Factory)
365 #define DECLARE_NAMESPACE_SERVICE_FACTORY(n, x) \
366 DECLARE_SERVICE_FACTORY(n::x)
371 #define DECLARE_SERVICE_FACTORY(x) DECLARE_COMPONENT(x)
372 #define DECLARE_NAMED_SERVICE_FACTORY(x, n) DECLARE_COMPONENT_WITH_ID(x, #n)
373 #define DECLARE_NAMESPACE_SERVICE_FACTORY(n, x) DECLARE_COMPONENT(n::x)
377 #endif // GAUDIKERNEL_SERVICE_H
The ServiceManager class is in charge of the creation of concrete instances of Services.
StatusCode setProperty(IProperty *component, const std::string &name, const TYPE &value, const std::string &doc)
simple function to set the property of the given object from the value
BooleanProperty m_auditInit
an helper to share the implementation of service() among the various kernel base classes ...
The ISvcLocator is the interface implemented by the Service Factory in the Application Manager to loc...
StatusCode finalize() override
Finalize (from INITIALIZED to CONFIGURED).
SmartIF< IAuditorSvc > m_pAuditorSvc
Auditor Service.
Gaudi::StateMachine::State FSMState() const override
GAUDI_API const std::string typeinfoName(const std::type_info &)
Get platform independent information about the class type.
The ISvcManager is the interface implemented by the Service Factory in the Application Manager to sup...
GAUDI_API bool hasProperty(const IProperty *p, const std::string &name)
simple function which check the existence of the property with the given name.
bool isSuccess() const
Test for a status code of SUCCESS.
SmartIF< ISvcLocator > & serviceLocator() const override
Function needed by CommonMessaging.
int outputLevel() const
get the Service's output level
SmartIF< ISvcLocator > m_svcLocator
Service Locator reference.
static S::ReturnType create(Args &&...args)
StatusCode restart() override
Initialization (from RUNNING to RUNNING, via INITIALIZED).
std::string m_name
Service Name.
State
Allowed states for classes implementing the state machine (ApplicationMgr, Algorithm, Service, AlgTool).
const char *PyHelper() getProperty(IInterface *p, char *name)
StatusCode configure() override
TYPE * get() const
Get interface pointer.
MsgStream & error() const
shortcut for the method msgStream(MSG::ERROR)
StatusCode stop() override
Stop (from RUNNING to INITIALIZED).
SmartIF< PropertyMgr > m_propertyMgr
Property Manager.
General service interface definition.
This class is used for returning status codes from appropriate routines.
StatusCode declarePrivateTool(ToolHandle< T > &handle, std::string toolTypeAndName="", bool createIf=true)
Declare used Private tool.
The IMessage is the interface implemented by the message service.
bool PyHelper() setProperty(IInterface *p, char *name, char *value)
bool m_auditorReinitialize
std::once_flag m_initFlag
const TYPE & value() const
explicit conversion
StatusCode service(const std::string &svcType, const std::string &svcName, T *&psvc) const
Access a service by name and type, creating it if it doesn't already exist.
SmartIF< IFace > service(const std::string &name, bool createIf=true) const
StatusCode declarePublicTool(ToolHandle< T > &handle, std::string toolTypeAndName="", bool createIf=true)
Declare used Public tool.
Property base class allowing Property* collections to be "homogeneous".
MsgStream & debug() const
shortcut for the method msgStream(MSG::DEBUG)
Class wrapping the signature for a factory with any number of arguments.
StatusCode reinitialize() override
Initialization (from INITIALIZED or RUNNING to INITIALIZED, via CONFIGURED).
StatusCode terminate() override
StatusCode service(const std::string &name, const T *&psvc, bool createIf=true) const
Access a service by name, creating it if it doesn't already exist.
SmartIF< IService > service(const std::string &name, const bool quiet=false, const bool createIf=true) const
SmartIF< ISvcManager > m_svcManager
SmartIF< IService > & service(const Gaudi::Utils::TypeNameString &typeName, const bool createIf=true) override
Returns a smart pointer to a service.
The IProperty is the basic interface for all components which have properties that can be set or get...
Base class for all services.
MSG::Level msgLevel() const
get the output level from the embedded MsgStream
Gaudi::PluginService::Factory< IService *, const std::string &, ISvcLocator * > Factory
Gaudi::StateMachine::State targetFSMState() const override
StatusCode service(const std::string &name, T *&psvc, bool createIf=true) const
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.