1 #ifndef GAUDIKERNEL_ALGORITHM_H
2 #define GAUDIKERNEL_ALGORITHM_H
6 #include "GaudiKernel/IProperty.h"
7 #include "GaudiKernel/IAlgorithm.h"
8 #include "GaudiKernel/IService.h"
9 #include "GaudiKernel/PropertyMgr.h"
10 #include "GaudiKernel/ISvcLocator.h"
11 #include "GaudiKernel/IMessageSvc.h"
12 #include "GaudiKernel/IStateful.h"
18 #include "GaudiKernel/IDataProviderSvc.h"
19 #include "GaudiKernel/IHistogramSvc.h"
20 #include "GaudiKernel/IConversionSvc.h"
21 #include "GaudiKernel/INTupleSvc.h"
22 #include "GaudiKernel/IChronoStatSvc.h"
23 #include "GaudiKernel/IRndmGenSvc.h"
24 #include "GaudiKernel/IAuditorSvc.h"
25 #include "GaudiKernel/IToolSvc.h"
26 #include "GaudiKernel/IMonitorSvc.h"
27 #include "GaudiKernel/IExceptionSvc.h"
28 #include "GaudiKernel/IAlgContextSvc.h"
29 #include "GaudiKernel/Property.h"
30 #include <Gaudi/PluginService.h>
32 #ifndef PACKAGE_VERSION
33 #define PACKAGE_VERSION "unknown"
147 const std::string&
name()
const override;
149 const std::string& version()
const override;
174 bool isExecuted( )
const override;
177 void setExecuted(
bool state )
override;
182 void resetExecuted( )
override;
194 bool isEnabled( )
const override;
197 bool filterPassed( )
const override;
200 void setFilterPassed(
bool state )
override;
203 inline int errorCount()
const {
return m_errorCount; }
208 (
const std::string&
name, T*& psvc,
bool createIf =
true )
const {
209 return service_i(name, createIf, T::interfaceID(), (
void**)&psvc);
214 StatusCode service(
const std::string& svcType,
const std::string& svcName,
216 return service_i(svcType, svcName, T::interfaceID(), (
void**)&psvc);
220 SmartIF<IService> service(
const std::string& name,
const bool createIf =
true,
const bool quiet =
false)
const;
223 SmartIF<T> service(
const std::string& name,
bool createIf =
true,
bool quiet =
false )
const {
224 return service(name,createIf,quiet).
as<T>();
228 void setOutputLevel(
int level );
328 bool registerContext()
const {
return m_registerContext ; }
343 const std::string& name,
Algorithm*& pSubAlg );
346 const std::vector<Algorithm*>* subAlgorithms()
const;
349 std::vector<Algorithm*>* subAlgorithms() ;
364 const std::vector<Property*>& getProperties( )
const override;
366 bool hasProperty(
const std::string& name)
const override;
408 (
const std::string& name ,
410 const std::string& doc =
"none" )
const
412 return m_propertyMgr->declareProperty(name, property, doc);
417 (
const std::string& name ,
419 const std::string& rname =
"" )
const
421 return m_propertyMgr -> declareRemoteProperty ( name , rsvc , rname );
436 if ( !m_pMonitorSvc ){
437 m_pMonitorSvc = service(m_monitorSvcName,
false,
true);
439 return m_pMonitorSvc;
448 void declareInfo(
const std::string& name,
450 const std::string& desc )
const
463 void declareInfo(
const std::string& name,
464 const std::string&
format,
467 const std::string& desc )
const
470 if ( mS ) mS->
declareInfo(name, format, var, size, desc,
this);
517 template <
class TYPE>
519 (
const std::string& name ,
532 int outputLevel()
const {
return (
int)m_outputLevel ; }
538 void initOutputLevel(
Property& prop);
544 std::string m_version;
545 std::vector<Algorithm *> m_subAlgms;
562 bool m_registerContext = false ;
563 std::string m_monitorSvcName;
570 bool m_auditorInitialize;
571 bool m_auditorReinitialize;
572 bool m_auditorRestart;
573 bool m_auditorExecute;
574 bool m_auditorFinalize;
575 bool m_auditorBeginRun;
576 bool m_auditorEndRun;
579 bool m_filterPassed =
true;
580 bool m_isEnabled =
true;
581 bool m_isExecuted =
false;
587 StatusCode service_i(
const std::string& svcName,
591 StatusCode service_i(
const std::string& svcType,
592 const std::string& svcName,
603 #ifndef GAUDI_NEW_PLUGIN_SERVICE
608 template <
typename S,
typename... Args>
609 static typename S::ReturnType
create(Args&&...
args) {
610 return new T(std::forward<Args>(
args)...);
616 #define DECLARE_ALGORITHM_FACTORY(x) \
617 DECLARE_FACTORY_WITH_CREATOR(x, AlgFactory< x >, Algorithm::Factory)
618 #define DECLARE_NAMED_ALGORITHM_FACTORY(x, n) \
619 DECLARE_FACTORY_WITH_CREATOR_AND_ID(x, AlgFactory< x >, \
620 #n, Algorithm::Factory)
621 #define DECLARE_NAMESPACE_ALGORITHM_FACTORY(n, x) \
622 DECLARE_ALGORITHM_FACTORY(n::x)
627 #define DECLARE_ALGORITHM_FACTORY(x) DECLARE_COMPONENT(x)
628 #define DECLARE_NAMED_ALGORITHM_FACTORY(x, n) DECLARE_COMPONENT_WITH_ID(x, #n)
629 #define DECLARE_NAMESPACE_ALGORITHM_FACTORY(n, x) DECLARE_COMPONENT(n::x)
633 #endif //GAUDIKERNEL_ALGORITHM_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)
implements & operator=(const implements &)
Assignment operator (do not touch the reference count).
SmartIF< IFace > as() const
return a new SmartIF instance to another interface
Definition of the IMonitorSvc interface, which publishes Gaudi variables to outside monitoring proces...
This class is used for returning status codes from appropriate routines.
bool PyHelper() setProperty(IInterface *p, char *name, char *value)
The IAlgorithm is the interface implemented by the Algorithm base class.
Base class from which all concrete algorithm classes should be derived.
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.
static S::ReturnType create(Args &&...args)
The IProperty is the basic interface for all components which have properties that can be set or get...
GAUDI_API std::string format(const char *,...)
MsgStream format utility "a la sprintf(...)".