Loading [MathJax]/extensions/tex2jax.js
The Gaudi Framework
v31r0 (aeb156f0)
Main Page
Related Pages
Modules
Namespaces
Classes
Files
File List
File Members
•
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Properties
Friends
Macros
Modules
Pages
IAlgExecStateSvc.h
Go to the documentation of this file.
1
#ifndef GAUDIKERNEL_IALGEXECSTATESVC_H
2
#define GAUDIKERNEL_IALGEXECSTATESVC_H 1
3
4
#include "
GaudiKernel/IAlgorithm.h
"
5
#include "
GaudiKernel/IInterface.h
"
6
#include "
GaudiKernel/StatusCode.h
"
7
#include "
GaudiKernel/StringKey.h
"
8
#include <map>
9
#include <sstream>
10
#include <string>
11
12
class
EventContext
;
13
14
//-----------------------------------------------------------------------------
15
25
//-----------------------------------------------------------------------------
26
27
class
AlgExecState
{
28
public
:
29
enum
State
{
None
= 0,
Executing
= 1,
Done
= 2 };
30
31
bool
filterPassed
()
const
{
return
m_filterPassed
; }
32
State
state
()
const
{
return
m_state
; }
33
const
StatusCode
&
execStatus
()
const
{
return
m_execStatus
; }
34
35
void
setFilterPassed
(
bool
f =
true
) {
m_filterPassed
= f; }
36
void
setState
(
State
s
) {
m_state
=
s
; }
37
void
setState
(
State
s
,
const
StatusCode
& sc ) {
38
m_state
=
s
;
39
m_execStatus
= sc;
40
}
41
void
setExecStatus
(
const
StatusCode
& sc =
StatusCode::SUCCESS
) {
m_execStatus
= sc; }
42
void
reset
() { *
this
=
AlgExecState
{}; }
43
44
private
:
45
bool
m_filterPassed
{
true
};
46
State
m_state
{State::None};
47
StatusCode
m_execStatus
{
StatusCode
(
StatusCode::FAILURE
,
true
)};
48
};
49
50
inline
std::ostream
&
operator<<
(
std::ostream
& ost,
const
AlgExecState
&
s
) {
51
ost <<
"e: "
;
52
switch
( s.
state
() ) {
53
case
AlgExecState::State::None:
54
return
ost <<
"n"
;
55
case
AlgExecState::State::Executing:
56
return
ost <<
"e"
;
57
default
:
58
return
ost <<
"d f: "
<< s.
filterPassed
() <<
" sc: "
<< s.
execStatus
();
59
}
60
}
61
62
namespace
EventStatus
{
63
enum
Status
{
Invalid
= 0,
Success
= 1,
AlgFail
= 2,
AlgStall
= 3,
Other
= 4 };
64
inline
std::ostream
&
operator<<
(
std::ostream
& os,
Status
s
) {
65
static
constexpr
std::array<const char*, 5>
label{
"Invalid"
,
"Success"
,
"AlgFail"
,
"AlgStall"
,
"Other"
};
66
return
os << label.at( s );
67
}
68
}
// namespace EventStatus
69
70
class
GAUDI_API
IAlgExecStateSvc
:
virtual
public
IInterface
{
71
public
:
73
DeclareInterfaceID
(
IAlgExecStateSvc
, 1, 0 );
74
75
typedef
std::map<Gaudi::StringKey, AlgExecState>
AlgStateMap_t
;
76
77
// get the Algorithm Execution State for a give Algorithm and EventContext
78
virtual
const
AlgExecState
& algExecState(
const
Gaudi::StringKey
& algName,
const
EventContext
& ctx )
const
= 0;
79
const
AlgExecState
&
algExecState
(
IAlgorithm
* iAlg,
const
EventContext
& ctx )
const
{
80
return
algExecState( iAlg->
nameKey
(), ctx );
81
}
82
virtual
AlgExecState
& algExecState(
IAlgorithm
* iAlg,
const
EventContext
& ctx ) = 0;
83
84
// get all the Algorithm Execution States for a given EventContext
85
virtual
const
AlgStateMap_t& algExecStates(
const
EventContext
& ctx )
const
= 0;
86
87
virtual
void
reset
(
const
EventContext
& ctx ) = 0;
88
89
virtual
void
addAlg(
const
Gaudi::StringKey
& algName ) = 0;
90
void
addAlg
(
IAlgorithm
* iAlg ) {
addAlg
( iAlg->
nameKey
() ); }
91
92
virtual
const
EventStatus::Status
& eventStatus(
const
EventContext
& ctx )
const
= 0;
93
94
virtual
void
setEventStatus(
const
EventStatus::Status
& sc,
const
EventContext
& ctx ) = 0;
95
96
virtual
void
updateEventStatus(
const
bool
& b,
const
EventContext
& ctx ) = 0;
97
98
virtual
unsigned
int
algErrorCount(
const
IAlgorithm
* iAlg )
const
= 0;
99
virtual
void
resetErrorCount(
const
IAlgorithm
* iAlg ) = 0;
100
virtual
unsigned
int
incrementErrorCount(
const
IAlgorithm
* iAlg ) = 0;
101
102
virtual
void
dump(
std::ostringstream
& ost,
const
EventContext
& ctx )
const
= 0;
103
};
104
105
#endif
IAlgExecStateSvc::algExecState
const AlgExecState & algExecState(IAlgorithm *iAlg, const EventContext &ctx) const
Definition:
IAlgExecStateSvc.h:79
IAlgorithm.h
EventStatus
Definition:
IAlgExecStateSvc.h:62
AlgExecState::Done
Definition:
IAlgExecStateSvc.h:29
AlgExecState::setExecStatus
void setExecStatus(const StatusCode &sc=StatusCode::SUCCESS)
Definition:
IAlgExecStateSvc.h:41
StatusCode::SUCCESS
constexpr static const auto SUCCESS
Definition:
StatusCode.h:85
AlgExecState::m_state
State m_state
Definition:
IAlgExecStateSvc.h:46
EventContext
This class represents an entry point to all the event specific data.
Definition:
EventContext.h:31
std::map
STL class.
EventStatus::Other
Definition:
IAlgExecStateSvc.h:63
Gaudi::StringKey
The helper class to represent the efficient "key" for access.
Definition:
StringKey.h:34
AlgExecState::m_filterPassed
bool m_filterPassed
Definition:
IAlgExecStateSvc.h:45
AlgExecState::setState
void setState(State s)
Definition:
IAlgExecStateSvc.h:36
AlgExecState::Executing
Definition:
IAlgExecStateSvc.h:29
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:37
StatusCode
This class is used for returning status codes from appropriate routines.
Definition:
StatusCode.h:50
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:244
EventStatus::AlgStall
Definition:
IAlgExecStateSvc.h:63
EventStatus::Invalid
Definition:
IAlgExecStateSvc.h:63
StringKey.h
EventStatus::Success
Definition:
IAlgExecStateSvc.h:63
AlgExecState::None
Definition:
IAlgExecStateSvc.h:29
EventStatus::AlgFail
Definition:
IAlgExecStateSvc.h:63
IAlgorithm::nameKey
virtual const Gaudi::StringKey & nameKey() const =0
StringKey rep of name.
EventStatus::Status
Status
Definition:
IAlgExecStateSvc.h:63
IAlgorithm
The IAlgorithm is the interface implemented by the Algorithm base class.
Definition:
IAlgorithm.h:28
gaudirun.s
string s
Definition:
gaudirun.py:312
std::array
STL class.
StatusCode::FAILURE
constexpr static const auto FAILURE
Definition:
StatusCode.h:86
AlgExecState::m_execStatus
StatusCode m_execStatus
Definition:
IAlgExecStateSvc.h:47
AlgExecState::State
State
Definition:
IAlgExecStateSvc.h:29
StatusCode.h
AlgExecState::filterPassed
bool filterPassed() const
Definition:
IAlgExecStateSvc.h:31
AlgExecState::setFilterPassed
void setFilterPassed(bool f=true)
Definition:
IAlgExecStateSvc.h:35
operator<<
std::ostream & operator<<(std::ostream &ost, const AlgExecState &s)
Definition:
IAlgExecStateSvc.h:50
IAlgExecStateSvc::addAlg
void addAlg(IAlgorithm *iAlg)
Definition:
IAlgExecStateSvc.h:90
GAUDI_API
#define GAUDI_API
Definition:
Kernel.h:71
IInterface.h
AlgExecState
Definition:
IAlgExecStateSvc.h:27
std::ostream
STL class.
AlgExecState::state
State state() const
Definition:
IAlgExecStateSvc.h:32
AlgExecState::reset
void reset()
Definition:
IAlgExecStateSvc.h:42
IAlgExecStateSvc::AlgStateMap_t
std::map< Gaudi::StringKey, AlgExecState > AlgStateMap_t
Definition:
IAlgExecStateSvc.h:75
AlgExecState::execStatus
const StatusCode & execStatus() const
Definition:
IAlgExecStateSvc.h:33
GaudiKernel
GaudiKernel
IAlgExecStateSvc.h
Generated on Mon Feb 11 2019 17:48:15 for The Gaudi Framework by
1.8.11