| The Gaudi Framework v29r0 (ff2e7097)

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

- File List
- File Members

IAlgExecStateSvc.h
Go to the documentation of this file.
1 #ifndef GAUDIKERNEL_IALGEXECSTATESVC_H
2 #define GAUDIKERNEL_IALGEXECSTATESVC_H 1
3
4 #include "GaudiKernel/IInterface.h"
5 #include "GaudiKernel/StatusCode.h"
6 #include "GaudiKernel/StringKey.h"
7 #include <map>
8 #include <sstream>
9 #include <string>
10
11 class IAlgorithm;
12 class EventContext;
13
14 //-----------------------------------------------------------------------------
15
25 //-----------------------------------------------------------------------------
26
27 class AlgExecState
28 {
29 public:
30 enum State { None = 0, Executing = 1, Done = 2 };
31
32 bool filterPassed() const { return m_filterPassed; }
33 State state() const { return m_state; }
34 const StatusCode& execStatus() const { return m_execStatus; }
35
36 void setFilterPassed( bool f = true ) { m_filterPassed = f; }
37 void setState( State s ) { m_state = s; }
38 void setState( State s, const StatusCode& sc )
39 {
40 m_state = s;
41 m_execStatus = sc;
42 }
43 void setExecStatus( const StatusCode& sc = StatusCode::SUCCESS ) { m_execStatus = sc; }
44 void reset() { *this = AlgExecState{}; }
45
46 private:
47 bool m_filterPassed{true};
48 State m_state{State::None};
49 StatusCode m_execStatus{StatusCode( StatusCode::FAILURE, true )};
50 };
51
52 inline std::ostream& operator<<( std::ostream& ost, const AlgExecState& s )
53 {
54 return ost << "e: " << s.state() << " f: " << s.filterPassed() << " sc: " << s.execStatus();
55 }
56
57 namespace EventStatus
58 {
59 enum Status { Invalid = 0, Success = 1, AlgFail = 2, AlgStall = 3, Other = 4 };
60 }
61
62 class GAUDI_API IAlgExecStateSvc : virtual public IInterface
63 {
64 public:
66 DeclareInterfaceID( IAlgExecStateSvc, 1, 0 );
67
68 typedef std::map<Gaudi::StringKey, AlgExecState> AlgStateMap_t;
69
70 // get the Algorithm Execution State for a give Algorithm and EventContext
71 virtual const AlgExecState& algExecState( const Gaudi::StringKey& algName, const EventContext& ctx ) const = 0;
72 virtual const AlgExecState& algExecState( IAlgorithm* iAlg, const EventContext& ctx ) const = 0;
73 virtual AlgExecState& algExecState( IAlgorithm* iAlg, const EventContext& ctx ) = 0;
74
75 // get all the Algorithm Execution States for a given EventContext
76 virtual const AlgStateMap_t& algExecStates( const EventContext& ctx ) const = 0;
77
78 virtual void reset( const EventContext& ctx ) = 0;
79
80 virtual void addAlg( IAlgorithm* iAlg ) = 0;
81 virtual void addAlg( const Gaudi::StringKey& algName ) = 0;
82
83 virtual const EventStatus::Status& eventStatus( const EventContext& ctx ) const = 0;
84
85 virtual void setEventStatus( const EventStatus::Status& sc, const EventContext& ctx ) = 0;
86
87 virtual void updateEventStatus( const bool& b, const EventContext& ctx ) = 0;
88
89 virtual unsigned int algErrorCount( const IAlgorithm* iAlg ) const = 0;
90 virtual void resetErrorCount( const IAlgorithm* iAlg ) = 0;
91 virtual unsigned int incrementErrorCount( const IAlgorithm* iAlg ) = 0;
92
93 virtual void dump( std::ostringstream& ost, const EventContext& ctx ) const = 0;
94 };
95
96 #endif
StatusCode::SUCCESS
Definition: StatusCode.h:31
StatusCode::FAILURE
Definition: StatusCode.h:31
EventStatus
Definition: IAlgExecStateSvc.h:57
AlgExecState::Done
Definition: IAlgExecStateSvc.h:30
AlgExecState::setExecStatus
void setExecStatus(const StatusCode &sc=StatusCode::SUCCESS)
Definition: IAlgExecStateSvc.h:43
AlgExecState::m_state
State m_state
Definition: IAlgExecStateSvc.h:48
EventContext
This class represents an entry point to all the event specific data.
Definition: EventContext.h:24
std::map
STL class.
EventStatus::Other
Definition: IAlgExecStateSvc.h:59
Gaudi::StringKey
The helper class to represent the efficient "key" for access.
Definition: StringKey.h:35
AlgExecState::m_filterPassed
bool m_filterPassed
Definition: IAlgExecStateSvc.h:47
AlgExecState::setState
void setState(State s)
Definition: IAlgExecStateSvc.h:37
AlgExecState::Executing
Definition: IAlgExecStateSvc.h:30
IAlgExecStateSvc
Abstract interface for a service that manages the Algorithm execution states.
Definition: IAlgExecStateSvc.h:62
AlgExecState::setState
void setState(State s, const StatusCode &sc)
Definition: IAlgExecStateSvc.h:38
StatusCode
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:28
DeclareInterfaceID
#define DeclareInterfaceID(iface, major, minor)
Macro to declare the interface ID when using the new mechanism of extending and implementing interfac...
Definition: IInterface.h:13
std::ostringstream
STL class.
IInterface
Definition of the basic interface.
Definition: IInterface.h:277
EventStatus::AlgStall
Definition: IAlgExecStateSvc.h:59
EventStatus::Invalid
Definition: IAlgExecStateSvc.h:59
StringKey.h
EventStatus::Success
Definition: IAlgExecStateSvc.h:59
AlgExecState::None
Definition: IAlgExecStateSvc.h:30
EventStatus::AlgFail
Definition: IAlgExecStateSvc.h:59
EventStatus::Status
Status
Definition: IAlgExecStateSvc.h:59
IAlgorithm
The IAlgorithm is the interface implemented by the Algorithm base class.
Definition: IAlgorithm.h:28
gaudirun.s
string s
Definition: gaudirun.py:253
AlgExecState::m_execStatus
StatusCode m_execStatus
Definition: IAlgExecStateSvc.h:49
AlgExecState::State
State
Definition: IAlgExecStateSvc.h:30
StatusCode.h
AlgExecState::filterPassed
bool filterPassed() const
Definition: IAlgExecStateSvc.h:32
AlgExecState::setFilterPassed
void setFilterPassed(bool f=true)
Definition: IAlgExecStateSvc.h:36
operator<<
std::ostream & operator<<(std::ostream &ost, const AlgExecState &s)
Definition: IAlgExecStateSvc.h:52
GAUDI_API
#define GAUDI_API
Definition: Kernel.h:110
IInterface.h
AlgExecState
Definition: IAlgExecStateSvc.h:27
std::ostream
STL class.
AlgExecState::state
State state() const
Definition: IAlgExecStateSvc.h:33
AlgExecState::reset
void reset()
Definition: IAlgExecStateSvc.h:44
IAlgExecStateSvc::AlgStateMap_t
std::map< Gaudi::StringKey, AlgExecState > AlgStateMap_t
Definition: IAlgExecStateSvc.h:68
AlgExecState::execStatus
const StatusCode & execStatus() const
Definition: IAlgExecStateSvc.h:34