1 #ifndef GAUDIKERNEL_ALGTOOL_H
2 #define GAUDIKERNEL_ALGTOOL_H
5 #include "GaudiKernel/IAlgTool.h"
6 #include "GaudiKernel/IProperty.h"
7 #include "GaudiKernel/IService.h"
8 #include "GaudiKernel/ISvcLocator.h"
9 #include "GaudiKernel/IMessageSvc.h"
10 #include "GaudiKernel/IToolSvc.h"
11 #include "GaudiKernel/PropertyMgr.h"
12 #include "GaudiKernel/IAuditorSvc.h"
13 #include "GaudiKernel/IMonitorSvc.h"
14 #include "GaudiKernel/IStateful.h"
15 #include <Gaudi/PluginService.h>
48 virtual const std::string&
name()
const;
51 virtual const std::string&
type()
const;
140 template <
class TYPE>
142 (
const std::string&
name ,
153 const std::string&
name,
180 (
const std::string&
name, T*& svc,
bool createIf =
true )
const {
181 return service_i(name, createIf, T::interfaceID(), (
void**)&svc);
188 return service_i(type, name, T::interfaceID(), (
void**)&svc);
197 template <
class I>
class declareInterface {
199 template <
class T> declareInterface(T* tool) {
200 tool->declInterface( I::interfaceID(), (I*)tool);
235 (
const std::string& name ,
237 const std::string& doc =
"none" )
const
239 return m_propertyMgr -> declareProperty ( name , property , doc ) ;
243 (
const std::string& name ,
245 const std::string& rname =
"" )
const
247 return m_propertyMgr-> declareRemoteProperty ( name , rsvc , rname ) ;
265 if ( !m_pMonitorSvc ){
266 service_i( m_monitorSvcName,
false,
269 return m_pMonitorSvc;
278 void declareInfo(
const std::string& name,
280 const std::string& desc )
const
293 void declareInfo(
const std::string& name,
294 const std::string&
format,
297 const std::string& desc )
const
300 if ( mS ) mS->
declareInfo(name, format, var, size, desc,
this);
306 int outputLevel ()
const {
return (
int)m_outputLevel ; }
312 void initOutputLevel(
Property& prop);
322 typedef std::list<std::pair<InterfaceID,void*> > InterfaceList;
325 const std::string m_name;
331 std::string m_monitorSvcName;
333 InterfaceList m_interfaceList;
334 std::string m_threadID;
337 StatusCode service_i(
const std::string& algName,
341 StatusCode service_i(
const std::string& svcType,
342 const std::string& svcName,
349 bool m_auditorInitialize;
352 bool m_auditorFinalize;
353 bool m_auditorReinitialize;
354 bool m_auditorRestart;
361 #ifndef GAUDI_NEW_PLUGIN_SERVICE
366 template <
typename S,
typename... Args>
367 static typename S::ReturnType
create(Args...
args) {
368 return new T(
args...);
374 #define DECLARE_TOOL_FACTORY(x) \
375 DECLARE_FACTORY_WITH_CREATOR(x, ToolFactory< x >, AlgTool::Factory)
376 #define DECLARE_NAMESPACE_TOOL_FACTORY(n, x) \
377 DECLARE_TOOL_FACTORY(n::x)
382 #define DECLARE_TOOL_FACTORY(x) DECLARE_COMPONENT(x)
383 #define DECLARE_NAMESPACE_TOOL_FACTORY(n,x) DECLARE_COMPONENT(n::x)
388 #endif // GAUDIKERNEL_ALGTOOL_H
virtual StatusCode restart()
Initialization (from RUNNING to RUNNING, via INITIALIZED).
virtual StatusCode configure()
Configuration (from OFFLINE to CONFIGURED).
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
Gaudi::StateMachine::State m_targetState
Service state.
The ISvcLocator is the interface implemented by the Service Factory in the Application Manager to loc...
Gaudi::StateMachine::State m_state
Service state.
Base class used to implement the interfaces.
SmartIF< IMessageSvc > & msgSvc() const
The standard message service.
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).
virtual StatusCode sysFinalize()
Finalize Service.
const char *PyHelper() getProperty(IInterface *p, char *name)
Property manager helper class.
Definition of the IMonitorSvc interface, which publishes Gaudi variables to outside monitoring proces...
virtual StatusCode queryInterface(const InterfaceID &ti, void **pp)
Implementation of IInterface::queryInterface.
This class is used for returning status codes from appropriate routines.
Definition of the basic interface.
The IMessage is the interface implemented by the message service.
bool PyHelper() setProperty(IInterface *p, char *name, char *value)
virtual StatusCode sysStop()
Initialize Service.
virtual StatusCode terminate()
Initialization (from CONFIGURED to OFFLINE).
virtual Gaudi::StateMachine::State FSMState() const
Get the current state.
StatusCode setProperties()
Method for setting declared properties to the values specified for the job.
virtual const std::string & name() const
Retrieve name of the service.
virtual StatusCode sysInitialize()
Initialize Service.
virtual StatusCode reinitialize()
Initialization (from INITIALIZED or RUNNING to INITIALIZED, via CONFIGURED).
Property base class allowing Property* collections to be "homogeneous".
virtual void declareInfo(const std::string &name, const bool &var, const std::string &desc, const IInterface *owner)=0
Declare monitoring information.
Class wrapping the signature for a factory with any number of arguments.
virtual StatusCode sysRestart()
Re-initialize the Service.
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.
virtual StatusCode sysReinitialize()
Re-initialize the Service.
PropertyMgr * m_propertyMgr
Property Manager.
virtual Gaudi::StateMachine::State targetFSMState() const
When we are in the middle of a transition, get the state where the transition is leading us...
The IProperty is the basic interface for all components which have properties that can be set or get...
The interface implemented by the IAuditorSvc base class.
Gaudi::PluginService::Factory< IService *, const std::string &, ISvcLocator * > Factory
virtual StatusCode sysStart()
Initialize Service.
static const InterfaceID & interfaceID()
Return an instance of InterfaceID identifying the interface.
GAUDI_API std::string format(const char *,...)
MsgStream format utility "a la sprintf(...)".
virtual const std::vector< Property * > & getProperties() const
Get list of properties.
SmartIF< ISvcLocator > & serviceLocator() const
Retrieve pointer to service locator.