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 const std::string&
name()
const override;
51 const std::string&
type()
const override;
93 const std::vector<Property*>& getProperties( )
const override;
96 inline PropertyMgr * getPropertyMgr() {
return m_propertyMgr.get(); }
140 template <
class TYPE>
142 (
const std::string&
name ,
153 const std::string& name,
160 ISvcLocator* svcLoc()
const {
return serviceLocator() ; }
180 (
const std::string& name, T*& svc,
bool createIf =
true )
const {
181 return service_i(name, createIf, T::interfaceID(), (
void**)&svc);
187 StatusCode service(
const std::string&
type,
const std::string& name, T*& svc)
const {
188 return service_i(type, name, T::interfaceID(), (
void**)&svc);
192 SmartIF<IService> service(
const std::string& name,
const bool createIf =
true,
const bool quiet =
false)
const;
194 template <
typename T>
195 SmartIF<T> service(
const std::string& name,
const bool createIf =
true,
const bool quiet =
false)
const
196 {
return SmartIF<T>( service(name,createIf,quiet) ); }
199 template <
typename I>
200 void declareInterface( I*
i ) { m_interfaceList.emplace_back( I::interfaceID(), i ); }
234 (
const std::string& name ,
236 const std::string& doc =
"none" )
const
238 return m_propertyMgr -> declareProperty ( name , property , doc ) ;
242 (
const std::string& name ,
244 const std::string& rname =
"" )
const
246 return m_propertyMgr-> declareRemoteProperty ( name , rsvc , rname ) ;
264 if ( !m_pMonitorSvc ) m_pMonitorSvc = service(m_monitorSvcName,
false,
true);
265 return m_pMonitorSvc.get();
274 void declareInfo(
const std::string& name,
276 const std::string& desc )
const
289 void declareInfo(
const std::string& name,
290 const std::string&
format,
293 const std::string& desc )
const
296 if ( mS ) mS->
declareInfo(name, format, var, size, desc,
this);
302 int outputLevel ()
const {
return (
int)m_outputLevel ; }
308 void initOutputLevel(
Property& prop);
318 typedef std::list<std::pair<InterfaceID,void*> > InterfaceList;
321 const std::string m_name;
327 std::string m_monitorSvcName;
329 InterfaceList m_interfaceList;
330 std::string m_threadID;
333 StatusCode service_i(
const std::string& algName,
337 StatusCode service_i(
const std::string& svcType,
338 const std::string& svcName,
345 bool m_auditorInitialize =
false;
346 bool m_auditorStart =
false;
347 bool m_auditorStop =
false;
348 bool m_auditorFinalize =
false;
349 bool m_auditorReinitialize =
false;
350 bool m_auditorRestart =
false;
357 #ifndef GAUDI_NEW_PLUGIN_SERVICE
362 template <
typename S,
typename... Args>
363 static typename S::ReturnType
create(Args&&...
args) {
364 return new T(std::forward<Args>(
args)...);
370 #define DECLARE_TOOL_FACTORY(x) \
371 DECLARE_FACTORY_WITH_CREATOR(x, ToolFactory< x >, AlgTool::Factory)
372 #define DECLARE_NAMESPACE_TOOL_FACTORY(n, x) \
373 DECLARE_TOOL_FACTORY(n::x)
378 #define DECLARE_TOOL_FACTORY(x) DECLARE_COMPONENT(x)
379 #define DECLARE_NAMESPACE_TOOL_FACTORY(n,x) DECLARE_COMPONENT(n::x)
384 #endif // GAUDIKERNEL_ALGTOOL_H
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
Base class used to implement the interfaces.
The ISvcLocator is the interface implemented by the Service Factory in the Application Manager to loc...
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.
Definition of the IMonitorSvc interface, which publishes Gaudi variables to outside monitoring proces...
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)
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.
StatusCode queryInterface(const InterfaceID &ti, void **pp) override
Implementation of IInterface::queryInterface.
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_API std::string format(const char *,...)
MsgStream format utility "a la sprintf(...)".