| The Gaudi Framework v29r1 (5cd95fa2)

- 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 ost << "e: ";
55 if ( s.state() == AlgExecState::State::None ) {
56 ost << "n";
57 } else if ( s.state() == AlgExecState::State::Executing ) {
58 ost << "e";
59 } else {
60 ost << "d f: " << s.filterPassed() << " sc: " << s.execStatus();
61 }
62 return ost;
63 }
64
65 namespace EventStatus
66 {
67 enum Status { Invalid = 0, Success = 1, AlgFail = 2, AlgStall = 3, Other = 4 };
68 }
69
70 class GAUDI_API IAlgExecStateSvc : virtual public IInterface
71 {
72 public:
74 DeclareInterfaceID( IAlgExecStateSvc, 1, 0 );
75
76 typedef std::map<Gaudi::StringKey, AlgExecState> AlgStateMap_t;
77
78 // get the Algorithm Execution State for a give Algorithm and EventContext
79 virtual const AlgExecState& algExecState( const Gaudi::StringKey& algName, const EventContext& ctx ) const = 0;
80 virtual const AlgExecState& algExecState( IAlgorithm* iAlg, const EventContext& ctx ) const = 0;
81 virtual AlgExecState& algExecState( IAlgorithm* iAlg, const EventContext& ctx ) = 0;
82
83 // get all the Algorithm Execution States for a given EventContext
84 virtual const AlgStateMap_t& algExecStates( const EventContext& ctx ) const = 0;
85
86 virtual void reset( const EventContext& ctx ) = 0;
87
88 virtual void addAlg( IAlgorithm* iAlg ) = 0;
89 virtual void addAlg( const Gaudi::StringKey& algName ) = 0;
90
91 virtual const EventStatus::Status& eventStatus( const EventContext& ctx ) const = 0;
92
93 virtual void setEventStatus( const EventStatus::Status& sc, const EventContext& ctx ) = 0;
94
95 virtual void updateEventStatus( const bool& b, const EventContext& ctx ) = 0;
96
97 virtual unsigned int algErrorCount( const IAlgorithm* iAlg ) const = 0;
98 virtual void resetErrorCount( const IAlgorithm* iAlg ) = 0;
99 virtual unsigned int incrementErrorCount( const IAlgorithm* iAlg ) = 0;
100
101 virtual void dump( std::ostringstream& ost, const EventContext& ctx ) const = 0;
102 };
103
104 #endif
StatusCode::SUCCESS
Definition: StatusCode.h:31
StatusCode::FAILURE
Definition: StatusCode.h:31
EventStatus
Definition: IAlgExecStateSvc.h:65
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:67
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:70
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:67
EventStatus::Invalid
Definition: IAlgExecStateSvc.h:67
StringKey.h
EventStatus::Success
Definition: IAlgExecStateSvc.h:67
AlgExecState::None
Definition: IAlgExecStateSvc.h:30
EventStatus::AlgFail
Definition: IAlgExecStateSvc.h:67
EventStatus::Status
Status
Definition: IAlgExecStateSvc.h:67
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:76
AlgExecState::execStatus
const StatusCode & execStatus() const
Definition: IAlgExecStateSvc.h:34