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 virtual const std::string& name()
const;
149 virtual const std::string& version()
const;
171 virtual bool isExecuted( )
const;
174 virtual void setExecuted(
bool state );
179 virtual void resetExecuted( );
196 virtual bool isEnabled( )
const;
199 virtual bool filterPassed( )
const;
202 virtual void setFilterPassed(
bool state );
205 inline int errorCount()
const {
return m_errorCount; }
210 (
const std::string& name, T*& psvc,
bool createIf =
true )
const {
211 return service_i(name, createIf, T::interfaceID(), (
void**)&psvc);
216 StatusCode service(
const std::string& svcType,
const std::string& svcName,
218 return service_i(svcType, svcName, T::interfaceID(), (
void**)&psvc);
222 SmartIF<IService> service(
const std::string& name,
const bool createIf =
true,
const bool quiet =
false)
const;
225 void setOutputLevel(
int level );
325 bool registerContext()
const {
return m_registerContext ; }
340 const std::string& name,
Algorithm*& pSubAlg );
343 std::vector<Algorithm*>* subAlgorithms()
const;
358 virtual const std::vector<Property*>& getProperties( )
const;
360 virtual bool hasProperty(
const std::string& name)
const;
402 (
const std::string& name ,
404 const std::string& doc =
"none" )
const
406 return m_propertyMgr->declareProperty(name, property, doc);
411 (
const std::string& name ,
413 const std::string& rname =
"" )
const
415 return m_propertyMgr -> declareRemoteProperty ( name , rsvc , rname );
430 if ( !m_pMonitorSvc.isValid() ){
431 m_pMonitorSvc = service(m_monitorSvcName,
false,
true);
433 return m_pMonitorSvc;
442 void declareInfo(
const std::string& name,
444 const std::string& desc )
const
457 void declareInfo(
const std::string& name,
458 const std::string&
format,
461 const std::string& desc )
const
464 if ( mS ) mS->
declareInfo(name, format, var, size, desc,
this);
511 template <
class TYPE>
513 (
const std::string& name ,
526 int outputLevel()
const {
return (
int)m_outputLevel ; }
532 void initOutputLevel(
Property& prop);
538 std::string m_version;
539 std::vector<Algorithm *>* m_subAlgms;
556 bool m_registerContext ;
557 std::string m_monitorSvcName;
564 bool m_auditorInitialize;
565 bool m_auditorReinitialize;
566 bool m_auditorRestart;
567 bool m_auditorExecute;
568 bool m_auditorFinalize;
569 bool m_auditorBeginRun;
570 bool m_auditorEndRun;
581 StatusCode service_i(
const std::string& svcName,
585 StatusCode service_i(
const std::string& svcType,
586 const std::string& svcName,
597 #ifndef GAUDI_NEW_PLUGIN_SERVICE
602 template <
typename S,
typename... Args>
603 static typename S::ReturnType
create(Args...
args) {
604 return new T(
args...);
610 #define DECLARE_ALGORITHM_FACTORY(x) \
611 DECLARE_FACTORY_WITH_CREATOR(x, AlgFactory< x >, Algorithm::Factory)
612 #define DECLARE_NAMED_ALGORITHM_FACTORY(x, n) \
613 DECLARE_FACTORY_WITH_CREATOR_AND_ID(x, AlgFactory< x >, \
614 #n, Algorithm::Factory)
615 #define DECLARE_NAMESPACE_ALGORITHM_FACTORY(n, x) \
616 DECLARE_ALGORITHM_FACTORY(n::x)
621 #define DECLARE_ALGORITHM_FACTORY(x) DECLARE_COMPONENT(x)
622 #define DECLARE_NAMED_ALGORITHM_FACTORY(x, n) DECLARE_COMPONENT_WITH_ID(x, #n)
623 #define DECLARE_NAMESPACE_ALGORITHM_FACTORY(n, x) DECLARE_COMPONENT(n::x)
627 #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
The ISvcLocator is the interface implemented by the Service Factory in the Application Manager to loc...
Base class used to implement the interfaces.
static S::ReturnType create(Args...args)
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.
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.
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(...)".