The Gaudi Framework  v29r0 (ff2e7097)
IAlgExecStateSvc.h
Go to the documentation of this file.
1 #ifndef GAUDIKERNEL_IALGEXECSTATESVC_H
2 #define GAUDIKERNEL_IALGEXECSTATESVC_H 1
3 
7 #include <map>
8 #include <sstream>
9 #include <string>
10 
11 class IAlgorithm;
12 class EventContext;
13 
14 //-----------------------------------------------------------------------------
15 
25 //-----------------------------------------------------------------------------
26 
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  }
44  void reset() { *this = AlgExecState{}; }
45 
46 private:
47  bool m_filterPassed{true};
48  State m_state{State::None};
50 };
51 
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:
67 
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
void setExecStatus(const StatusCode &sc=StatusCode::SUCCESS)
This class represents an entry point to all the event specific data.
Definition: EventContext.h:24
STL class.
The helper class to represent the efficient "key" for access.
Definition: StringKey.h:35
void setState(State s)
Abstract interface for a service that manages the Algorithm execution states.
void setState(State s, const StatusCode &sc)
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:28
#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
Definition of the basic interface.
Definition: IInterface.h:277
The IAlgorithm is the interface implemented by the Algorithm base class.
Definition: IAlgorithm.h:28
string s
Definition: gaudirun.py:253
StatusCode m_execStatus
bool filterPassed() const
void setFilterPassed(bool f=true)
std::ostream & operator<<(std::ostream &ost, const AlgExecState &s)
#define GAUDI_API
Definition: Kernel.h:110
STL class.
State state() const
std::map< Gaudi::StringKey, AlgExecState > AlgStateMap_t
const StatusCode & execStatus() const