| The Gaudi Framework v32r1 (f65d50dc)

AlgExecStateSvc.h
Go to the documentation of this file.
1 #ifndef GAUDICORESVC_ALGEXECSTATESVC_H
2 #define GAUDICORESVC_ALGEXECSTATESVC_H 1
3
4 #include "GaudiKernel/IAlgExecStateSvc.h"
5 #include "GaudiKernel/IAlgorithm.h"
6 #include "GaudiKernel/Service.h"
7
8 #include <map>
9 #include <mutex>
10 #include <vector>
11
16 class AlgExecStateSvc : public extends<Service, IAlgExecStateSvc> {
17 public:
18 using extends::extends;
19
20 typedef IAlgExecStateSvc::AlgStateMap_t AlgStateMap_t;
21
22 using IAlgExecStateSvc::algExecState;
23 const AlgExecState& algExecState( const Gaudi::StringKey& algName, const EventContext& ctx ) const override;
24 AlgExecState& algExecState( IAlgorithm* iAlg, const EventContext& ctx ) override;
25 const AlgStateMap_t& algExecStates( const EventContext& ctx ) const override;
26
27 void reset( const EventContext& ctx ) override;
28
29 using IAlgExecStateSvc::addAlg;
30 void addAlg( const Gaudi::StringKey& algName ) override;
31
32 const EventStatus::Status& eventStatus( const EventContext& ctx ) const override;
33
34 void setEventStatus( const EventStatus::Status& sc, const EventContext& ctx ) override;
35
36 void updateEventStatus( const bool& b, const EventContext& ctx ) override;
37
38 unsigned int algErrorCount( const IAlgorithm* iAlg ) const override;
39 void resetErrorCount( const IAlgorithm* iAlg ) override;
40 unsigned int incrementErrorCount( const IAlgorithm* iAlg ) override;
41
42 void dump( std::ostringstream& ost, const EventContext& ctx ) const override;
43
44 private:
45 // one vector entry per event slot
46 std::vector<AlgStateMap_t> m_algStates;
47
48 std::vector<EventStatus::Status> m_eventStatus;
49 std::vector<Gaudi::StringKey> m_preInitAlgs;
50
51 std::map<Gaudi::StringKey, std::atomic<unsigned int>> m_errorCount;
52
53 void init();
54 void checkInit() const;
55 std::once_flag m_initFlag;
56 bool m_isInit = false;
57
58 std::mutex m_mut;
59 };
60
61 #endif
AlgExecStateSvc::resetErrorCount
void resetErrorCount(const IAlgorithm *iAlg) override
Definition: AlgExecStateSvc.cpp:197
AlgExecStateSvc
A service that keeps track of the execution state of Algorithm.
Definition: AlgExecStateSvc.h:16
AlgExecStateSvc::AlgStateMap_t
IAlgExecStateSvc::AlgStateMap_t AlgStateMap_t
Definition: AlgExecStateSvc.h:20
AlgExecStateSvc::m_algStates
std::vector< AlgStateMap_t > m_algStates
Definition: AlgExecStateSvc.h:46
IAlgExecStateSvc.h
AlgExecStateSvc::algErrorCount
unsigned int algErrorCount(const IAlgorithm *iAlg) const override
Definition: AlgExecStateSvc.cpp:184
AlgExecStateSvc::init
void init()
Definition: AlgExecStateSvc.cpp:12
IAlgorithm.h
AlgExecStateSvc::m_errorCount
std::map< Gaudi::StringKey, std::atomic< unsigned int > > m_errorCount
Definition: AlgExecStateSvc.h:51
AlgExecStateSvc::addAlg
void addAlg(const Gaudi::StringKey &algName) override
Definition: AlgExecStateSvc.cpp:83
AlgExecStateSvc::updateEventStatus
void updateEventStatus(const bool &b, const EventContext &ctx) override
Definition: AlgExecStateSvc.cpp:161
AlgExecStateSvc::m_initFlag
std::once_flag m_initFlag
Definition: AlgExecStateSvc.h:55
AlgExecStateSvc::dump
void dump(std::ostringstream &ost, const EventContext &ctx) const override
Definition: AlgExecStateSvc.cpp:69
std::once_flag
EventContext
This class represents an entry point to all the event specific data.
Definition: EventContext.h:24
std::map
STL class.
AlgExecStateSvc::checkInit
void checkInit() const
Definition: AlgExecStateSvc.cpp:59
Gaudi::StringKey
The helper class to represent the efficient "key" for access.
Definition: StringKey.h:34
std::mutex
IAlgExecStateSvc::algExecState
virtual const AlgExecState & algExecState(const Gaudi::StringKey &algName, const EventContext &ctx) const =0
Service.h
AlgExecStateSvc::algExecState
const AlgExecState & algExecState(const Gaudi::StringKey &algName, const EventContext &ctx) const override
Definition: AlgExecStateSvc.cpp:111
std::ostringstream
STL class.
AlgExecStateSvc::algExecStates
const AlgStateMap_t & algExecStates(const EventContext &ctx) const override
Definition: AlgExecStateSvc.cpp:140
AlgExecStateSvc::incrementErrorCount
unsigned int incrementErrorCount(const IAlgorithm *iAlg) override
Definition: AlgExecStateSvc.cpp:209
AlgExecStateSvc::m_preInitAlgs
std::vector< Gaudi::StringKey > m_preInitAlgs
Definition: AlgExecStateSvc.h:49
EventStatus::Status
Status
Definition: IAlgExecStateSvc.h:63
IAlgorithm
The IAlgorithm is the interface implemented by the Algorithm base class.
Definition: IAlgorithm.h:28
AlgExecStateSvc::m_isInit
bool m_isInit
Definition: AlgExecStateSvc.h:56
AlgExecStateSvc::m_mut
std::mutex m_mut
Definition: AlgExecStateSvc.h:58
AlgExecStateSvc::reset
void reset(const EventContext &ctx) override
Definition: AlgExecStateSvc.cpp:173
std::vector
STL class.
extends
Base class used to extend a class implementing other interfaces.
Definition: extends.h:10
AlgExecStateSvc::eventStatus
const EventStatus::Status & eventStatus(const EventContext &ctx) const override
Definition: AlgExecStateSvc.cpp:147
AlgExecStateSvc::m_eventStatus
std::vector< EventStatus::Status > m_eventStatus
Definition: AlgExecStateSvc.h:48
AlgExecStateSvc::setEventStatus
void setEventStatus(const EventStatus::Status &sc, const EventContext &ctx) override
Definition: AlgExecStateSvc.cpp:154
AlgExecState
Definition: IAlgExecStateSvc.h:27
IAlgExecStateSvc::addAlg
virtual void addAlg(const Gaudi::StringKey &algName)=0