| The Gaudi Framework v28r2-patches (bc4ad17a)

- 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
5 #include "GaudiKernel/Service.h"
6 #include "GaudiKernel/IAlgExecStateSvc.h"
7 #include "GaudiKernel/IAlgorithm.h"
8
9
10 #include <vector>
11 #include <map>
12 #include <mutex>
13
18 class AlgExecStateSvc: public extends<Service,
19 IAlgExecStateSvc> {
20 public:
22 AlgExecStateSvc( const std::string& name, ISvcLocator* svc );
23
25 ~AlgExecStateSvc();
26
27 virtual StatusCode initialize() override final;
28 virtual StatusCode finalize() override final;
29
30 typedef IAlgExecStateSvc::AlgStateMap_t AlgStateMap_t;
31
32 const AlgExecState& algExecState(const Gaudi::StringKey& algName,
33 const EventContext& ctx) const override;
34 const AlgExecState& algExecState(IAlgorithm* iAlg,
35 const EventContext& ctx) const override;
36 AlgExecState& algExecState(IAlgorithm* iAlg,
37 const EventContext& ctx) override;
38 const AlgStateMap_t& algExecStates(const EventContext& ctx) const override;
39
40 void reset(const EventContext& ctx) override;
41
42 void addAlg(IAlgorithm* iAlg) override;
43 void addAlg(const Gaudi::StringKey& algName) override;
44
45 const EventStatus::Status& eventStatus(const EventContext& ctx) const override;
46
47 void setEventStatus(const EventStatus::Status& sc, const EventContext& ctx) override;
48
49 void updateEventStatus(const bool& b, const EventContext& ctx) override;
50
51 unsigned int algErrorCount(const IAlgorithm* iAlg) const override;
52 void resetErrorCount(const IAlgorithm* iAlg) override;
53 unsigned int incrementErrorCount(const IAlgorithm* iAlg) override;
54
55 void dump(std::ostringstream& ost, const EventContext& ctx) const override;
56
57 private:
58
59 std::string trans(const EventStatus::Status& sc) const;
60
61 // one vector entry per event slot
62 // typedef std::map<Gaudi::StringKey, AlgExecState> AlgStateMap_t;
63 typedef std::vector< AlgStateMap_t > AlgStates_t;
64 AlgStates_t m_algStates;
65
66 std::vector< EventStatus::Status > m_eventStatus;
67 std::vector< Gaudi::StringKey > m_preInitAlgs;
68
69 typedef std::map< Gaudi::StringKey, std::atomic<unsigned int> > AlgErrorMap_t;
70 AlgErrorMap_t m_errorCount;
71
72 void init();
73 void checkInit() const;
74 std::once_flag m_initFlag;
75 bool m_isInit;
76
77 std::mutex m_mut;
78 };
79
80 #endif
AlgExecStateSvc::resetErrorCount
void resetErrorCount(const IAlgorithm *iAlg) override
Definition: AlgExecStateSvc.cpp:325
AlgExecStateSvc
A service that keeps track of the execution state of Algorithm *.
Definition: AlgExecStateSvc.h:18
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:30
AlgExecStateSvc::finalize
virtual StatusCode finalize() override final
Definition: AlgExecStateSvc.cpp:121
Service::name
const std::string & name() const override
Retrieve name of the service.
Definition: Service.cpp:289
IAlgExecStateSvc.h
AlgExecStateSvc::algExecState
const AlgExecState & algExecState(const Gaudi::StringKey &algName, const EventContext &ctx) const override
Definition: AlgExecStateSvc.cpp:201
AlgExecStateSvc::m_algStates
AlgStates_t m_algStates
Definition: AlgExecStateSvc.h:64
AlgExecStateSvc::init
void init()
Definition: AlgExecStateSvc.cpp:30
IAlgorithm.h
AlgExecStateSvc::dump
void dump(std::ostringstream &ost, const EventContext &ctx) const override
Definition: AlgExecStateSvc.cpp:130
AlgExecStateSvc::m_eventStatus
std::vector< EventStatus::Status > m_eventStatus
Definition: AlgExecStateSvc.h:66
AlgExecStateSvc::updateEventStatus
void updateEventStatus(const bool &b, const EventContext &ctx) override
Definition: AlgExecStateSvc.cpp:275
AlgExecStateSvc::m_initFlag
std::once_flag m_initFlag
Definition: AlgExecStateSvc.h:74
std::once_flag
EventContext
This class represents an entry point to all the event specific data.
Definition: EventContext.h:25
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:91
Service.h
StatusCode
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:26
std::ostringstream
STL class.
AlgExecStateSvc::m_errorCount
AlgErrorMap_t m_errorCount
Definition: AlgExecStateSvc.h:70
AlgExecStateSvc::incrementErrorCount
unsigned int incrementErrorCount(const IAlgorithm *iAlg) override
Definition: AlgExecStateSvc.cpp:338
AlgExecStateSvc::AlgErrorMap_t
std::map< Gaudi::StringKey, std::atomic< unsigned int > > AlgErrorMap_t
Definition: AlgExecStateSvc.h:69
AlgExecStateSvc::trans
std::string trans(const EventStatus::Status &sc) const
Definition: AlgExecStateSvc.cpp:352
EventStatus::Status
Status
Definition: IAlgExecStateSvc.h:62
AlgExecStateSvc::algErrorCount
unsigned int algErrorCount(const IAlgorithm *iAlg) const override
Definition: AlgExecStateSvc.cpp:310
IAlgorithm
The IAlgorithm is the interface implemented by the Algorithm base class.
Definition: IAlgorithm.h:27
AlgExecStateSvc::m_isInit
bool m_isInit
Definition: AlgExecStateSvc.h:75
AlgExecStateSvc::algExecStates
const AlgStateMap_t & algExecStates(const EventContext &ctx) const override
Definition: AlgExecStateSvc.cpp:249
AlgExecStateSvc::m_mut
std::mutex m_mut
Definition: AlgExecStateSvc.h:77
AlgExecStateSvc::reset
void reset(const EventContext &ctx) override
Definition: AlgExecStateSvc.cpp:293
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:259
AlgExecStateSvc::~AlgExecStateSvc
~AlgExecStateSvc()
Destructor.
Definition: AlgExecStateSvc.cpp:23
AlgExecStateSvc::AlgExecStateSvc
AlgExecStateSvc(const std::string &name, ISvcLocator *svc)
Constructor.
Definition: AlgExecStateSvc.cpp:15
AlgExecStateSvc::initialize
virtual StatusCode initialize() override final
Definition: AlgExecStateSvc.cpp:103
AlgExecStateSvc::AlgStates_t
std::vector< AlgStateMap_t > AlgStates_t
Definition: AlgExecStateSvc.h:63
AlgExecStateSvc::setEventStatus
void setEventStatus(const EventStatus::Status &sc, const EventContext &ctx) override
Definition: AlgExecStateSvc.cpp:267
AlgExecState
Definition: IAlgExecStateSvc.h:27
AlgExecStateSvc::addAlg
void addAlg(IAlgorithm *iAlg) override
Definition: AlgExecStateSvc.cpp:154
AlgExecStateSvc::m_preInitAlgs
std::vector< Gaudi::StringKey > m_preInitAlgs
Definition: AlgExecStateSvc.h:67