The Gaudi Framework
v30r3 (a5ef0a68)
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
inline
std::ostream
&
operator<<
(
std::ostream
& os,
Status
s
)
69
{
70
static
const
std::array<const char*, 5>
label{
"Invalid"
,
"Success"
,
"AlgFail"
,
"AlgStall"
,
"Other"
};
71
return
os << label.at( s );
72
}
73
}
74
75
class
GAUDI_API
IAlgExecStateSvc
:
virtual
public
IInterface
76
{
77
public
:
79
DeclareInterfaceID
(
IAlgExecStateSvc
, 1, 0 );
80
81
typedef
std::map<Gaudi::StringKey, AlgExecState>
AlgStateMap_t
;
82
83
// get the Algorithm Execution State for a give Algorithm and EventContext
84
virtual
const
AlgExecState
& algExecState(
const
Gaudi::StringKey
& algName,
const
EventContext
& ctx )
const
= 0;
85
virtual
const
AlgExecState
& algExecState(
IAlgorithm
* iAlg,
const
EventContext
& ctx )
const
= 0;
86
virtual
AlgExecState
& algExecState(
IAlgorithm
* iAlg,
const
EventContext
& ctx ) = 0;
87
88
// get all the Algorithm Execution States for a given EventContext
89
virtual
const
AlgStateMap_t& algExecStates(
const
EventContext
& ctx )
const
= 0;
90
91
virtual
void
reset
(
const
EventContext
& ctx ) = 0;
92
93
virtual
void
addAlg(
IAlgorithm
* iAlg ) = 0;
94
virtual
void
addAlg(
const
Gaudi::StringKey
& algName ) = 0;
95
96
virtual
const
EventStatus::Status
& eventStatus(
const
EventContext
& ctx )
const
= 0;
97
98
virtual
void
setEventStatus(
const
EventStatus::Status
& sc,
const
EventContext
& ctx ) = 0;
99
100
virtual
void
updateEventStatus(
const
bool
& b,
const
EventContext
& ctx ) = 0;
101
102
virtual
unsigned
int
algErrorCount(
const
IAlgorithm
* iAlg )
const
= 0;
103
virtual
void
resetErrorCount(
const
IAlgorithm
* iAlg ) = 0;
104
virtual
unsigned
int
incrementErrorCount(
const
IAlgorithm
* iAlg ) = 0;
105
106
virtual
void
dump(
std::ostringstream
& ost,
const
EventContext
& ctx )
const
= 0;
107
};
108
109
#endif
StatusCode::FAILURE
constexpr static const auto FAILURE
Definition:
StatusCode.h:88
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:75
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:51
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
StatusCode::SUCCESS
constexpr static const auto SUCCESS
Definition:
StatusCode.h:87
gaudirun.s
string s
Definition:
gaudirun.py:253
std::array
STL class.
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:104
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:81
AlgExecState::execStatus
const StatusCode & execStatus() const
Definition:
IAlgExecStateSvc.h:34
GaudiKernel
GaudiKernel
IAlgExecStateSvc.h
Generated on Wed Aug 1 2018 23:21:03 for The Gaudi Framework by
1.8.11