| The Gaudi Framework v32r1 (f65d50dc)

Classes | Public Types | Public Member Functions | Private Member Functions | Private Attributes | List of all members
AlgsExecutionStates Class Referencefinal

The AlgsExecutionStates encodes the state machine for the execution of algorithms within a single event. More...

`#include <GaudiKernel/AlgsExecutionStates.h>`

Collaboration diagram for AlgsExecutionStates:
[legend]

## Classes
class | Iterator

## Public Types
enum | State : uint8_t { INITIAL = 0, CONTROLREADY = 1, DATAREADY = 2, SCHEDULED = 3, EVTACCEPTED = 4, EVTREJECTED = 5, ERROR = 6 }
| Execution states of the algorithms. More...

## Public Member Functions
| AlgsExecutionStates (unsigned int algsNumber, SmartIF< IMessageSvc > MS)
StatusCode | set (unsigned int iAlgo, State newState)
void | reset ()
bool | contains (State state) const
| check if the collection contains at least one state of requested type More...
bool | containsAny (std::initializer_list< State > l) const
| check if the collection contains at least one state of any listed types More...
bool | containsOnly (std::initializer_list< State > l) const
| check if the collection contains only states of listed types More...
const State & | operator[] (unsigned int i) const
size_t | size () const
size_t | sizeOfSubset (State state) const
Iterator | begin (State kind)
Iterator | end (State kind)

## Private Member Functions
MsgStream | log ()

## Private Attributes
std::vector< State > | m_states
SmartIF< IMessageSvc > | m_MS

## Detailed Description

The AlgsExecutionStates encodes the state machine for the execution of algorithms within a single event.

It is used by the concurrent schedulers

Author
  Benedikt Hegner
  Danilo Piparo

Version
  1.0

Definition at line 26 of file AlgsExecutionStates.h.

## Member Enumeration Documentation

## ◆ State

enum AlgsExecutionStates::State : uint8_t

Execution states of the algorithms.

Enumerator
INITIAL |
CONTROLREADY |
DATAREADY |
SCHEDULED |
EVTACCEPTED |
EVTREJECTED |
ERROR |

Definition at line 29 of file AlgsExecutionStates.h.

29 : uint8_t {
30 INITIAL = 0,
31 CONTROLREADY = 1,
32 DATAREADY = 2,
33 SCHEDULED = 3,
34 EVTACCEPTED = 4,
35 EVTREJECTED = 5,
36 ERROR = 6
37 };
AlgsExecutionStates::ERROR
Definition: AlgsExecutionStates.h:36
AlgsExecutionStates::DATAREADY
Definition: AlgsExecutionStates.h:32
AlgsExecutionStates::EVTREJECTED
Definition: AlgsExecutionStates.h:35
AlgsExecutionStates::EVTACCEPTED
Definition: AlgsExecutionStates.h:34
AlgsExecutionStates::SCHEDULED
Definition: AlgsExecutionStates.h:33
uint8_t
unsigned char uint8_t
Definition: instrset.h:137
AlgsExecutionStates::CONTROLREADY
Definition: AlgsExecutionStates.h:31
AlgsExecutionStates::INITIAL
Definition: AlgsExecutionStates.h:30

## Constructor & Destructor Documentation

## ◆ AlgsExecutionStates()

AlgsExecutionStates::AlgsExecutionStates | ( | unsigned int | algsNumber,
|  | SmartIF< IMessageSvc > | MS
| ) |  |
| inline

Definition at line 39 of file AlgsExecutionStates.h.

40 : m_states( algsNumber, INITIAL ), m_MS( std::move( MS ) ){};
AlgsExecutionStates::m_MS
SmartIF< IMessageSvc > m_MS
Definition: AlgsExecutionStates.h:70
std::move
T move(T... args)
AlgsExecutionStates::INITIAL
Definition: AlgsExecutionStates.h:30
AlgsExecutionStates::m_states
std::vector< State > m_states
Definition: AlgsExecutionStates.h:69

## Member Function Documentation

## ◆ begin()

Iterator AlgsExecutionStates::begin | ( | State | kind | ) |
| inline

Definition at line 103 of file AlgsExecutionStates.h.

103 { return {kind, m_states, m_states.begin()}; }
AlgsExecutionStates::m_states
std::vector< State > m_states
Definition: AlgsExecutionStates.h:69
std::vector::begin
T begin(T... args)

## ◆ contains()

bool AlgsExecutionStates::contains | ( | State | state | ) | const
| inline

check if the collection contains at least one state of requested type

Definition at line 47 of file AlgsExecutionStates.h.

47 { return std::find( m_states.begin(), m_states.end(), state ) != m_states.end(); }
std::vector::end
T end(T... args)
compareRootHistos.state
def state
Definition: compareRootHistos.py:455
std::find
T find(T... args)
AlgsExecutionStates::m_states
std::vector< State > m_states
Definition: AlgsExecutionStates.h:69
std::vector::begin
T begin(T... args)

## ◆ containsAny()

bool AlgsExecutionStates::containsAny | ( | std::initializer_list< State > | l | ) | const
| inline

check if the collection contains at least one state of any listed types

Definition at line 50 of file AlgsExecutionStates.h.

50 {
51 return std::find_first_of( m_states.begin(), m_states.end(), l.begin(), l.end() ) != m_states.end();
52 }
std::vector::end
T end(T... args)
std::find_first_of
T find_first_of(T... args)
gaudirun.l
dictionary l
Definition: gaudirun.py:521
AlgsExecutionStates::m_states
std::vector< State > m_states
Definition: AlgsExecutionStates.h:69
std::vector::begin
T begin(T... args)

## ◆ containsOnly()

bool AlgsExecutionStates::containsOnly | ( | std::initializer_list< State > | l | ) | const
| inline

check if the collection contains only states of listed types

Definition at line 55 of file AlgsExecutionStates.h.

55 {
56 return std::all_of( m_states.begin(), m_states.end(),
57 [l]( State s ) { return std::find( l.begin(), l.end(), s ) != l.end(); } );
58 };
std::vector::end
T end(T... args)
AlgsExecutionStates::State
State
Execution states of the algorithms.
Definition: AlgsExecutionStates.h:29
gaudirun.l
dictionary l
Definition: gaudirun.py:521
std::find
T find(T... args)
AlgsExecutionStates::m_states
std::vector< State > m_states
Definition: AlgsExecutionStates.h:69
std::vector::begin
T begin(T... args)
std::all_of
T all_of(T... args)
gaudirun.s
string s
Definition: gaudirun.py:316

## ◆ end()

Iterator AlgsExecutionStates::end | ( | State | kind | ) |
| inline

Definition at line 104 of file AlgsExecutionStates.h.

104 { return {kind, m_states, m_states.end()}; }
std::vector::end
T end(T... args)
AlgsExecutionStates::m_states
std::vector< State > m_states
Definition: AlgsExecutionStates.h:69

## ◆ log()

MsgStream AlgsExecutionStates::log | ( |  | ) |
| inline private

Definition at line 72 of file AlgsExecutionStates.h.

72 { return {m_MS, "AlgsExecutionStates"}; }
AlgsExecutionStates::m_MS
SmartIF< IMessageSvc > m_MS
Definition: AlgsExecutionStates.h:70

## ◆ operator[]()

const State& AlgsExecutionStates::operator[] | ( | unsigned int | i | ) | const
| inline

Definition at line 60 of file AlgsExecutionStates.h.

60 { return m_states.at( i ); };
std::vector::at
T at(T... args)
AlgsExecutionStates::m_states
std::vector< State > m_states
Definition: AlgsExecutionStates.h:69

## ◆ reset()

void AlgsExecutionStates::reset | ( |  | ) |
| inline

Definition at line 44 of file AlgsExecutionStates.h.

44 { std::fill( m_states.begin(), m_states.end(), INITIAL ); };
std::vector::end
T end(T... args)
AlgsExecutionStates::INITIAL
Definition: AlgsExecutionStates.h:30
AlgsExecutionStates::m_states
std::vector< State > m_states
Definition: AlgsExecutionStates.h:69
std::vector::begin
T begin(T... args)
std::fill
T fill(T... args)

## ◆ set()

StatusCode AlgsExecutionStates::set | ( | unsigned int | iAlgo,
|  | State | newState
| ) |  |

Definition at line 13 of file AlgsExecutionStates.cpp.

13 {
14 if ( iAlgo >= m_states.size() ) {
15 log() << MSG::ERROR << "Index out of bound (" << iAlgo << " / " << m_states.size() << ")" << endmsg;
16 return StatusCode::FAILURE;
17 }
18
19 switch ( transition( m_states[iAlgo], newState ) ) {
20 case transition( INITIAL, CONTROLREADY ): // Fallthrough
21 case transition( CONTROLREADY, DATAREADY ): // Fallthrough
22 case transition( DATAREADY, SCHEDULED ): // Fallthrough
23 case transition( SCHEDULED, ERROR ): // Fallthrough
24 case transition( SCHEDULED, EVTACCEPTED ): // Fallthrough
25 case transition( SCHEDULED, EVTREJECTED ):
26 m_states[iAlgo] = newState;
27 return StatusCode::SUCCESS;
28 default:
29 log() << MSG::ERROR << "[AlgIndex " << iAlgo << "] Transition from " << m_states[iAlgo] << " to " << newState
30 << " is not allowed" << endmsg;
31 m_states[iAlgo] = ERROR;
32 return StatusCode::FAILURE;
33 }
34 }
AlgsExecutionStates::ERROR
Definition: AlgsExecutionStates.h:36
StatusCode::SUCCESS
constexpr static const auto SUCCESS
Definition: StatusCode.h:85
AlgsExecutionStates::DATAREADY
Definition: AlgsExecutionStates.h:32
AlgsExecutionStates::EVTREJECTED
Definition: AlgsExecutionStates.h:35
AlgsExecutionStates::EVTACCEPTED
Definition: AlgsExecutionStates.h:34
AlgsExecutionStates::SCHEDULED
Definition: AlgsExecutionStates.h:33
AlgsExecutionStates::CONTROLREADY
Definition: AlgsExecutionStates.h:31
AlgsExecutionStates::INITIAL
Definition: AlgsExecutionStates.h:30
std::vector::size
T size(T... args)
AlgsExecutionStates::m_states
std::vector< State > m_states
Definition: AlgsExecutionStates.h:69
StatusCode::FAILURE
constexpr static const auto FAILURE
Definition: StatusCode.h:86
MSG::ERROR
Definition: IMessageSvc.h:15
AlgsExecutionStates::log
MsgStream log()
Definition: AlgsExecutionStates.h:72
endmsg
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:192

## ◆ size()

size_t AlgsExecutionStates::size | ( |  | ) | const
| inline

Definition at line 62 of file AlgsExecutionStates.h.

62 { return m_states.size(); }
std::vector::size
T size(T... args)
AlgsExecutionStates::m_states
std::vector< State > m_states
Definition: AlgsExecutionStates.h:69

## ◆ sizeOfSubset()

size_t AlgsExecutionStates::sizeOfSubset | ( | State | state | ) | const
| inline

Definition at line 64 of file AlgsExecutionStates.h.

64 {
65 return std::count_if( m_states.begin(), m_states.end(), [&]( State s ) { return s == state; } );
66 }
std::vector::end
T end(T... args)
compareRootHistos.state
def state
Definition: compareRootHistos.py:455
AlgsExecutionStates::State
State
Execution states of the algorithms.
Definition: AlgsExecutionStates.h:29
std::count_if
T count_if(T... args)
AlgsExecutionStates::m_states
std::vector< State > m_states
Definition: AlgsExecutionStates.h:69
std::vector::begin
T begin(T... args)
gaudirun.s
string s
Definition: gaudirun.py:316

## Member Data Documentation

## ◆ m_MS

SmartIF<IMessageSvc> AlgsExecutionStates::m_MS
| private

Definition at line 70 of file AlgsExecutionStates.h.

## ◆ m_states

std::vector<State> AlgsExecutionStates::m_states
| private

Definition at line 69 of file AlgsExecutionStates.h.

The documentation for this class was generated from the following files:

- GaudiHive/src/AlgsExecutionStates.h
- GaudiHive/src/AlgsExecutionStates.cpp