1 #ifndef GAUDIKERNEL_SERVICE_H
2 #define GAUDIKERNEL_SERVICE_H
6 #include "GaudiKernel/IService.h"
7 #include "GaudiKernel/ISvcLocator.h"
8 #include "GaudiKernel/ServiceLocatorHelper.h"
9 #include "GaudiKernel/IProperty.h"
10 #include "GaudiKernel/IStateful.h"
11 #include "GaudiKernel/PropertyMgr.h"
12 #include "GaudiKernel/Property.h"
13 #include "GaudiKernel/IAuditorSvc.h"
14 #include "GaudiKernel/CommonMessaging.h"
15 #include "GaudiKernel/SmartIF.h"
16 #include <Gaudi/PluginService.h>
44 virtual unsigned long release();
47 virtual const std::string&
name()
const;
81 virtual const std::vector<Property*>& getProperties( )
const;
124 template <
class TYPE>
126 (
const std::string&
name ,
150 const_cast<T*
>(psvc)->
addRef();
159 StatusCode service(
const std::string& name, T*& psvc,
bool createIf =
true )
const {
179 return service(svcType +
"/" + svcName, psvc);
212 (
const std::string& name ,
214 const std::string& doc =
"none" )
const
216 return m_propertyMgr -> declareProperty ( name , property , doc ) ;
228 (
const std::string& name ,
230 const std::string& rname =
"" )
const
232 return m_propertyMgr -> declareRemoteProperty ( name , rsvc , rname ) ;
251 int outputLevel()
const {
return m_outputLevel.
value(); }
267 bool m_auditorInitialize;
270 bool m_auditorFinalize;
271 bool m_auditorReinitialize;
272 bool m_auditorRestart;
275 void initOutputLevel(
Property& prop);
278 #ifndef GAUDI_NEW_PLUGIN_SERVICE
283 template <
typename S,
typename... Args>
284 static typename S::ReturnType
create(Args...
args) {
285 return new T(
args...);
291 #define DECLARE_SERVICE_FACTORY(x) \
292 DECLARE_FACTORY_WITH_CREATOR(x, SvcFactory< x >, Service::Factory)
293 #define DECLARE_NAMED_SERVICE_FACTORY(x, n) \
294 DECLARE_FACTORY_WITH_CREATOR_AND_ID(x, SvcFactory< x >, #n, Service::Factory)
295 #define DECLARE_NAMESPACE_SERVICE_FACTORY(n, x) \
296 DECLARE_SERVICE_FACTORY(n::x)
301 #define DECLARE_SERVICE_FACTORY(x) DECLARE_COMPONENT(x)
302 #define DECLARE_NAMED_SERVICE_FACTORY(x, n) DECLARE_COMPONENT_WITH_ID(x, #n)
303 #define DECLARE_NAMESPACE_SERVICE_FACTORY(n, x) DECLARE_COMPONENT(n::x)
307 #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
an helper to share the implementation of service() among the various kernel base classes $Id: ...
virtual StatusCode terminate()
Initialization (from CONFIGURED to OFFLINE).
virtual StatusCode configure()
Configuration (from OFFLINE to CONFIGURED).
virtual Gaudi::StateMachine::State targetFSMState() const
When we are in the middle of a transition, get the state where the transition is leading us...
virtual StatusCode stop()
Stop (from RUNNING to INITIALIZED).
The ISvcLocator is the interface implemented by the Service Factory in the Application Manager to loc...
const std::string & name() const
Return the name of the manager (implementation of INamedInterface)
virtual SmartIF< ISvcLocator > & serviceLocator() const =0
Needed to locate the message service.
The ISvcManager is the interface implemented by the Service Factory in the Application Manager to sup...
virtual StatusCode reinitialize()
Initialization (from INITIALIZED or RUNNING to INITIALIZED, via CONFIGURED).
GAUDI_API bool hasProperty(const IProperty *p, const std::string &name)
simple function which check the existence of the property with the given name.
State
Allowed states for classes implementing the state machine (ApplicationMgr, Algorithm, Service, AlgTool).
const char *PyHelper() getProperty(IInterface *p, char *name)
Property manager helper class.
static S::ReturnType create(Args...args)
General service interface definition.
This class is used for returning status codes from appropriate routines.
The IMessage is the interface implemented by the message service.
bool PyHelper() setProperty(IInterface *p, char *name, char *value)
virtual StatusCode finalize()
Finalize (from INITIALIZED to CONFIGURED).
const TYPE & value() const
explicit conversion
virtual Gaudi::StateMachine::State FSMState() const
Get the current state.
Property base class allowing Property* collections to be "homogeneous".
virtual unsigned long release()=0
Release Interface instance.
Class wrapping the signature for a factory with any number of arguments.
virtual const std::string & name() const =0
This is needed to avoid ambiguous calls to name()
Templated class to add the standard messaging functionalities.
virtual unsigned long addRef()=0
Increment the reference count of Interface instance.
virtual SmartIF< IService > & service(const Gaudi::Utils::TypeNameString &typeName, const bool createIf=true)
Returns a smart pointer to a service.
virtual StatusCode restart()
Initialization (from RUNNING to RUNNING, via INITIALIZED).
The IProperty is the basic interface for all components which have properties that can be set or get...
Base class for all services.
SmartIF< ISvcLocator > m_svcLocator
Service locator (needed to access the MessageSvc)