| The Gaudi Framework v29r0 (ff2e7097)

- Main Page
- Related Pages
- Modules
- Namespaces
- Classes
- Files

- File List
- File Members

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 {
18 public:
20 AlgExecStateSvc( const std::string& name, ISvcLocator* svc );
21
23 ~AlgExecStateSvc();
24
25 virtual StatusCode initialize() override final;
26 virtual StatusCode finalize() override final;
27
28 typedef IAlgExecStateSvc::AlgStateMap_t AlgStateMap_t;
29
30 const AlgExecState& algExecState( const Gaudi::StringKey& algName, const EventContext& ctx ) const override;
31 const AlgExecState& algExecState( IAlgorithm* iAlg, const EventContext& ctx ) const override;
32 AlgExecState& algExecState( IAlgorithm* iAlg, const EventContext& ctx ) override;
33 const AlgStateMap_t& algExecStates( const EventContext& ctx ) const override;
34
35 void reset( const EventContext& ctx ) override;
36
37 void addAlg( IAlgorithm* iAlg ) override;
38 void addAlg( const Gaudi::StringKey& algName ) override;
39
40 const EventStatus::Status& eventStatus( const EventContext& ctx ) const override;
41
42 void setEventStatus( const EventStatus::Status& sc, const EventContext& ctx ) override;
43
44 void updateEventStatus( const bool& b, const EventContext& ctx ) override;
45
46 unsigned int algErrorCount( const IAlgorithm* iAlg ) const override;
47 void resetErrorCount( const IAlgorithm* iAlg ) override;
48 unsigned int incrementErrorCount( const IAlgorithm* iAlg ) override;
49
50 void dump( std::ostringstream& ost, const EventContext& ctx ) const override;
51
52 private:
53 std::string trans( const EventStatus::Status& sc ) const;
54
55 // one vector entry per event slot
56 // typedef std::map<Gaudi::StringKey, AlgExecState> AlgStateMap_t;
57 typedef std::vector<AlgStateMap_t> AlgStates_t;
58 AlgStates_t m_algStates;
59
60 std::vector<EventStatus::Status> m_eventStatus;
61 std::vector<Gaudi::StringKey> m_preInitAlgs;
62
63 typedef std::map<Gaudi::StringKey, std::atomic<unsigned int>> AlgErrorMap_t;
64 AlgErrorMap_t m_errorCount;
65
66 void init();
67 void checkInit() const;
68 std::once_flag m_initFlag;
69 bool m_isInit;
70
71 std::mutex m_mut;
72 };
73
74 #endif
AlgExecStateSvc::resetErrorCount
void resetErrorCount(const IAlgorithm *iAlg) override
Definition: AlgExecStateSvc.cpp:287
AlgExecStateSvc
A service that keeps track of the execution state of Algorithm *.
Definition: AlgExecStateSvc.h:16
ISvcLocator
The ISvcLocator is the interface implemented by the Service Factory in the Application Manager to loc...
Definition: ISvcLocator.h:25
AlgExecStateSvc::AlgStateMap_t
IAlgExecStateSvc::AlgStateMap_t AlgStateMap_t
Definition: AlgExecStateSvc.h:28
AlgExecStateSvc::finalize
virtual StatusCode finalize() override final
Definition: AlgExecStateSvc.cpp:108
Service::name
const std::string & name() const override
Retrieve name of the service.
Definition: Service.cpp:289
AlgExecStateSvc::AlgErrorMap_t
std::map< Gaudi::StringKey, std::atomic< unsigned int > > AlgErrorMap_t
Definition: AlgExecStateSvc.h:63
IAlgExecStateSvc.h
AlgExecStateSvc::algExecState
const AlgExecState & algExecState(const Gaudi::StringKey &algName, const EventContext &ctx) const override
Definition: AlgExecStateSvc.cpp:173
AlgExecStateSvc::m_algStates
AlgStates_t m_algStates
Definition: AlgExecStateSvc.h:58
AlgExecStateSvc::init
void init()
Definition: AlgExecStateSvc.cpp:25
IAlgorithm.h
AlgExecStateSvc::dump
void dump(std::ostringstream &ost, const EventContext &ctx) const override
Definition: AlgExecStateSvc.cpp:112
AlgExecStateSvc::updateEventStatus
void updateEventStatus(const bool &b, const EventContext &ctx) override
Definition: AlgExecStateSvc.cpp:241
AlgExecStateSvc::m_initFlag
std::once_flag m_initFlag
Definition: AlgExecStateSvc.h:68
std::once_flag
EventContext
This class represents an entry point to all the event specific data.
Definition: EventContext.h:24
std::map
STL class.
Gaudi::StringKey
The helper class to represent the efficient "key" for access.
Definition: StringKey.h:35
std::mutex
std::string
STL class.
AlgExecStateSvc::checkInit
void checkInit() const
Definition: AlgExecStateSvc.cpp:80
Service.h
StatusCode
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:28
std::ostringstream
STL class.
AlgExecStateSvc::m_errorCount
AlgErrorMap_t m_errorCount
Definition: AlgExecStateSvc.h:64
AlgExecStateSvc::incrementErrorCount
unsigned int incrementErrorCount(const IAlgorithm *iAlg) override
Definition: AlgExecStateSvc.cpp:300
AlgExecStateSvc::m_preInitAlgs
std::vector< Gaudi::StringKey > m_preInitAlgs
Definition: AlgExecStateSvc.h:61
AlgExecStateSvc::trans
std::string trans(const EventStatus::Status &sc) const
Definition: AlgExecStateSvc.cpp:314
EventStatus::Status
Status
Definition: IAlgExecStateSvc.h:59
AlgExecStateSvc::algErrorCount
unsigned int algErrorCount(const IAlgorithm *iAlg) const override
Definition: AlgExecStateSvc.cpp:272
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:69
AlgExecStateSvc::algExecStates
const AlgStateMap_t & algExecStates(const EventContext &ctx) const override
Definition: AlgExecStateSvc.cpp:215
AlgExecStateSvc::m_mut
std::mutex m_mut
Definition: AlgExecStateSvc.h:71
AlgExecStateSvc::reset
void reset(const EventContext &ctx) override
Definition: AlgExecStateSvc.cpp:257
std::vector< AlgStateMap_t >
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:225
AlgExecStateSvc::~AlgExecStateSvc
~AlgExecStateSvc()
Destructor.
Definition: AlgExecStateSvc.cpp:21
AlgExecStateSvc::AlgExecStateSvc
AlgExecStateSvc(const std::string &name, ISvcLocator *svc)
Constructor.
Definition: AlgExecStateSvc.cpp:14
AlgExecStateSvc::initialize
virtual StatusCode initialize() override final
Definition: AlgExecStateSvc.cpp:91
AlgExecStateSvc::m_eventStatus
std::vector< EventStatus::Status > m_eventStatus
Definition: AlgExecStateSvc.h:60
AlgExecStateSvc::setEventStatus
void setEventStatus(const EventStatus::Status &sc, const EventContext &ctx) override
Definition: AlgExecStateSvc.cpp:233
AlgExecStateSvc::AlgStates_t
std::vector< AlgStateMap_t > AlgStates_t
Definition: AlgExecStateSvc.h:57
AlgExecState
Definition: IAlgExecStateSvc.h:27
AlgExecStateSvc::addAlg
void addAlg(IAlgorithm *iAlg) override
Definition: AlgExecStateSvc.cpp:134