The Gaudi Framework
v33r0 (d5ea422b)
IAlgExecStateSvc.h
Go to the documentation of this file.
1
/***********************************************************************************\
2
* (c) Copyright 1998-2019 CERN for the benefit of the LHCb and ATLAS collaborations *
3
* *
4
* This software is distributed under the terms of the Apache version 2 licence, *
5
* copied verbatim in the file "LICENSE". *
6
* *
7
* In applying this licence, CERN does not waive the privileges and immunities *
8
* granted to it by virtue of its status as an Intergovernmental Organization *
9
* or submit itself to any jurisdiction. *
10
\***********************************************************************************/
11
#ifndef GAUDIKERNEL_IALGEXECSTATESVC_H
12
#define GAUDIKERNEL_IALGEXECSTATESVC_H 1
13
14
#include "
GaudiKernel/IAlgorithm.h
"
15
#include "
GaudiKernel/IInterface.h
"
16
#include "
GaudiKernel/StatusCode.h
"
17
#include "
GaudiKernel/StringKey.h
"
18
#include <map>
19
#include <sstream>
20
#include <string>
21
22
class
EventContext
;
23
24
//-----------------------------------------------------------------------------
25
35
//-----------------------------------------------------------------------------
36
37
class
AlgExecState
{
38
public
:
39
enum
State
{
None
= 0,
Executing
= 1,
Done
= 2 };
40
41
bool
filterPassed
()
const
{
return
m_filterPassed
; }
42
State
state
()
const
{
return
m_state
; }
43
const
StatusCode
&
execStatus
()
const
{
return
m_execStatus
; }
44
45
void
setFilterPassed
(
bool
f =
true
) {
m_filterPassed
= f; }
46
void
setState
(
State
s
) {
m_state
=
s
; }
47
void
setState
(
State
s
,
const
StatusCode
& sc ) {
48
m_state
=
s
;
49
m_execStatus
= sc;
50
}
51
void
setExecStatus
(
const
StatusCode
& sc =
StatusCode::SUCCESS
) {
m_execStatus
= sc; }
52
void
reset
() { *
this
=
AlgExecState
{}; }
53
54
private
:
55
bool
m_filterPassed
{
true
};
56
State
m_state
{State::None};
57
StatusCode
m_execStatus
{
StatusCode
(
StatusCode::FAILURE
,
true
)};
58
};
59
60
inline
std::ostream
&
operator<<
(
std::ostream
& ost,
const
AlgExecState
&
s
) {
61
ost <<
"e: "
;
62
switch
(
s
.state() ) {
63
case
AlgExecState::State::None:
64
return
ost <<
"n"
;
65
case
AlgExecState::State::Executing:
66
return
ost <<
"e"
;
67
default
:
68
return
ost <<
"d f: "
<<
s
.filterPassed() <<
" sc: "
<<
s
.execStatus();
69
}
70
}
71
72
namespace
EventStatus
{
73
enum
Status
{
Invalid
= 0,
Success
= 1,
AlgFail
= 2,
AlgStall
= 3,
Other
= 4 };
74
inline
std::ostream
&
operator<<
(
std::ostream
& os,
Status
s
) {
75
static
constexpr
std::array<const char*, 5>
label{
"Invalid"
,
"Success"
,
"AlgFail"
,
"AlgStall"
,
"Other"
};
76
return
os << label.at(
s
);
77
}
78
}
// namespace EventStatus
79
80
class
GAUDI_API
IAlgExecStateSvc
:
virtual
public
IInterface
{
81
public
:
83
DeclareInterfaceID
(
IAlgExecStateSvc
, 1, 0 );
84
85
typedef
std::map<Gaudi::StringKey, AlgExecState>
AlgStateMap_t
;
86
87
// get the Algorithm Execution State for a give Algorithm and EventContext
88
virtual
const
AlgExecState
& algExecState(
const
Gaudi::StringKey
& algName,
const
EventContext
&
ctx
)
const
= 0;
89
const
AlgExecState
&
algExecState
(
IAlgorithm
* iAlg,
const
EventContext
&
ctx
)
const
{
90
return
algExecState( iAlg->
nameKey
(),
ctx
);
91
}
92
virtual
AlgExecState
& algExecState(
IAlgorithm
* iAlg,
const
EventContext
&
ctx
) = 0;
93
94
// get all the Algorithm Execution States for a given EventContext
95
virtual
const
AlgStateMap_t& algExecStates(
const
EventContext
&
ctx
)
const
= 0;
96
97
virtual
void
reset(
const
EventContext
&
ctx
) = 0;
98
99
virtual
void
addAlg(
const
Gaudi::StringKey
& algName ) = 0;
100
void
addAlg
(
IAlgorithm
* iAlg ) {
addAlg
( iAlg->
nameKey
() ); }
101
102
virtual
const
EventStatus::Status
& eventStatus(
const
EventContext
&
ctx
)
const
= 0;
103
104
virtual
void
setEventStatus(
const
EventStatus::Status
& sc,
const
EventContext
&
ctx
) = 0;
105
106
virtual
void
updateEventStatus(
const
bool
& b,
const
EventContext
&
ctx
) = 0;
107
108
virtual
unsigned
int
algErrorCount(
const
IAlgorithm
* iAlg )
const
= 0;
109
virtual
void
resetErrorCount(
const
IAlgorithm
* iAlg ) = 0;
110
virtual
unsigned
int
incrementErrorCount(
const
IAlgorithm
* iAlg ) = 0;
111
112
virtual
void
dump(
std::ostringstream
& ost,
const
EventContext
&
ctx
)
const
= 0;
113
};
114
115
#endif
EventStatus::operator<<
std::ostream & operator<<(std::ostream &os, Status s)
Definition:
IAlgExecStateSvc.h:74
IAlgorithm.h
EventStatus
Definition:
IAlgExecStateSvc.h:72
AlgExecState::Done
Definition:
IAlgExecStateSvc.h:39
AlgExecState::setExecStatus
void setExecStatus(const StatusCode &sc=StatusCode::SUCCESS)
Definition:
IAlgExecStateSvc.h:51
StatusCode::SUCCESS
constexpr static const auto SUCCESS
Definition:
StatusCode.h:96
GaudiPython.Pythonizations.ctx
ctx
Definition:
Pythonizations.py:566
AlgExecState::filterPassed
bool filterPassed() const
Definition:
IAlgExecStateSvc.h:41
AlgExecState::m_state
State m_state
Definition:
IAlgExecStateSvc.h:56
EventContext
This class represents an entry point to all the event specific data.
Definition:
EventContext.h:34
std::map
STL class.
EventStatus::Other
Definition:
IAlgExecStateSvc.h:73
Gaudi::StringKey
The helper class to represent the efficient "key" for access.
Definition:
StringKey.h:44
AlgExecState::m_filterPassed
bool m_filterPassed
Definition:
IAlgExecStateSvc.h:55
AlgExecState::setState
void setState(State s)
Definition:
IAlgExecStateSvc.h:46
IAlgExecStateSvc::algExecState
const AlgExecState & algExecState(IAlgorithm *iAlg, const EventContext &ctx) const
Definition:
IAlgExecStateSvc.h:89
AlgExecState::Executing
Definition:
IAlgExecStateSvc.h:39
IAlgorithm::nameKey
virtual const Gaudi::StringKey & nameKey() const =0
StringKey rep of name.
IAlgExecStateSvc
Abstract interface for a service that manages the Algorithm execution states.
Definition:
IAlgExecStateSvc.h:80
AlgExecState::setState
void setState(State s, const StatusCode &sc)
Definition:
IAlgExecStateSvc.h:47
StatusCode
This class is used for returning status codes from appropriate routines.
Definition:
StatusCode.h:61
AlgExecState::state
State state() const
Definition:
IAlgExecStateSvc.h:42
std::ostringstream
STL class.
IInterface
Definition of the basic interface.
Definition:
IInterface.h:254
AlgExecState::execStatus
const StatusCode & execStatus() const
Definition:
IAlgExecStateSvc.h:43
EventStatus::AlgStall
Definition:
IAlgExecStateSvc.h:73
EventStatus::Invalid
Definition:
IAlgExecStateSvc.h:73
StringKey.h
EventStatus::Success
Definition:
IAlgExecStateSvc.h:73
AlgExecState::None
Definition:
IAlgExecStateSvc.h:39
EventStatus::AlgFail
Definition:
IAlgExecStateSvc.h:73
EventStatus::Status
Status
Definition:
IAlgExecStateSvc.h:73
IAlgorithm
The IAlgorithm is the interface implemented by the Algorithm base class.
Definition:
IAlgorithm.h:38
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:23
gaudirun.s
string s
Definition:
gaudirun.py:328
std::array
STL class.
StatusCode::FAILURE
constexpr static const auto FAILURE
Definition:
StatusCode.h:97
AlgExecState::m_execStatus
StatusCode m_execStatus
Definition:
IAlgExecStateSvc.h:57
AlgExecState::State
State
Definition:
IAlgExecStateSvc.h:39
StatusCode.h
AlgExecState::setFilterPassed
void setFilterPassed(bool f=true)
Definition:
IAlgExecStateSvc.h:45
operator<<
std::ostream & operator<<(std::ostream &ost, const AlgExecState &s)
Definition:
IAlgExecStateSvc.h:60
IAlgExecStateSvc::addAlg
void addAlg(IAlgorithm *iAlg)
Definition:
IAlgExecStateSvc.h:100
GAUDI_API
#define GAUDI_API
Definition:
Kernel.h:81
IInterface.h
AlgExecState
Definition:
IAlgExecStateSvc.h:37
std::ostream
STL class.
AlgExecState::reset
void reset()
Definition:
IAlgExecStateSvc.h:52
IAlgExecStateSvc::AlgStateMap_t
std::map< Gaudi::StringKey, AlgExecState > AlgStateMap_t
Definition:
IAlgExecStateSvc.h:85
GaudiKernel
GaudiKernel
IAlgExecStateSvc.h
Generated on Mon Dec 16 2019 23:26:33 for The Gaudi Framework by
1.8.15