| The Gaudi Framework v29r0 (ff2e7097)

- Main Page
- Related Pages
- Modules
- Namespaces
- Classes
- Files

- Class List
- Class Index
- Class Hierarchy
- Class Members

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

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 : unsigned short { 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)
| ~AlgsExecutionStates ()
StatusCode | updateState (unsigned int iAlgo, State newState)
void | reset ()
bool | algsPresent (State state) const
bool | allAlgsExecuted ()
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)

## Static Public Attributes
static std::map< State, std::string > | stateNames

## 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 28 of file AlgsExecutionStates.h.

## Member Enumeration Documentation

enum AlgsExecutionStates::State : unsigned short

Execution states of the algorithms.

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

Definition at line 32 of file AlgsExecutionStates.h.

32 : unsigned short {
33 INITIAL = 0,
34 CONTROLREADY = 1,
35 DATAREADY = 2,
36 SCHEDULED = 3,
37 EVTACCEPTED = 4,
38 EVTREJECTED = 5,
39 ERROR = 6
40 };
AlgsExecutionStates::ERROR
Definition: AlgsExecutionStates.h:39
AlgsExecutionStates::SCHEDULED
Definition: AlgsExecutionStates.h:36
AlgsExecutionStates::EVTACCEPTED
Definition: AlgsExecutionStates.h:37
AlgsExecutionStates::INITIAL
Definition: AlgsExecutionStates.h:33
AlgsExecutionStates::CONTROLREADY
Definition: AlgsExecutionStates.h:34
AlgsExecutionStates::DATAREADY
Definition: AlgsExecutionStates.h:35
AlgsExecutionStates::EVTREJECTED
Definition: AlgsExecutionStates.h:38

## Constructor & Destructor Documentation

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

Definition at line 44 of file AlgsExecutionStates.h.

45 : m_states( algsNumber, INITIAL ), m_MS( MS ){};
AlgsExecutionStates::INITIAL
Definition: AlgsExecutionStates.h:33
AlgsExecutionStates::m_MS
SmartIF< IMessageSvc > m_MS
Definition: AlgsExecutionStates.h:76
AlgsExecutionStates::m_states
std::vector< State > m_states
Definition: AlgsExecutionStates.h:75

AlgsExecutionStates::~AlgsExecutionStates | ( |  | ) |
| inline

Definition at line 47 of file AlgsExecutionStates.h.

47 {};

## Member Function Documentation

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

Definition at line 53 of file AlgsExecutionStates.h.

54 {
55 return std::find( m_states.begin(), m_states.end(), state ) != m_states.end();
56 }
compareRootHistos.state
state
Definition: compareRootHistos.py:422
std::vector::end
T end(T...args)
std::find
T find(T...args)
AlgsExecutionStates::m_states
std::vector< State > m_states
Definition: AlgsExecutionStates.h:75
std::vector::begin
T begin(T...args)

bool AlgsExecutionStates::allAlgsExecuted | ( |  | ) |
| inline

Definition at line 58 of file AlgsExecutionStates.h.

59 {
60 int execAlgos = std::count_if( m_states.begin(), m_states.end(),
61 []( State s ) { return ( s == EVTACCEPTED || s == EVTREJECTED ); } );
62 return m_states.size() == (unsigned int)execAlgos;
63 };
std::vector::end
T end(T...args)
AlgsExecutionStates::EVTACCEPTED
Definition: AlgsExecutionStates.h:37
std::count_if
T count_if(T...args)
std::vector::size
T size(T...args)
AlgsExecutionStates::m_states
std::vector< State > m_states
Definition: AlgsExecutionStates.h:75
std::vector::begin
T begin(T...args)
gaudirun.s
string s
Definition: gaudirun.py:253
AlgsExecutionStates::EVTREJECTED
Definition: AlgsExecutionStates.h:38
AlgsExecutionStates::State
State
Execution states of the algorithms.
Definition: AlgsExecutionStates.h:32

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

Definition at line 125 of file AlgsExecutionStates.h.

125 { return ( Iterator( Iterator::POS::BEGIN, kind, m_states ) ); }
AlgsExecutionStates::m_states
std::vector< State > m_states
Definition: AlgsExecutionStates.h:75
Iterator
boost::spirit::classic::position_iterator2< ForwardIterator > Iterator
Definition: Iterator.h:18

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

Definition at line 127 of file AlgsExecutionStates.h.

127 { return ( Iterator( Iterator::POS::END, kind, m_states ) ); }
AlgsExecutionStates::m_states
std::vector< State > m_states
Definition: AlgsExecutionStates.h:75
Iterator
boost::spirit::classic::position_iterator2< ForwardIterator > Iterator
Definition: Iterator.h:18

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

Definition at line 65 of file AlgsExecutionStates.h.

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

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

Definition at line 51 of file AlgsExecutionStates.h.

51 { m_states.assign( m_states.size(), INITIAL ); };
AlgsExecutionStates::INITIAL
Definition: AlgsExecutionStates.h:33
std::vector::size
T size(T...args)
std::vector::assign
T assign(T...args)
AlgsExecutionStates::m_states
std::vector< State > m_states
Definition: AlgsExecutionStates.h:75

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

Definition at line 67 of file AlgsExecutionStates.h.

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

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

Definition at line 69 of file AlgsExecutionStates.h.

70 {
71 return std::count_if( m_states.begin(), m_states.end(), [&]( State s ) { return ( s == state ); } );
72 }
compareRootHistos.state
state
Definition: compareRootHistos.py:422
std::vector::end
T end(T...args)
std::count_if
T count_if(T...args)
AlgsExecutionStates::m_states
std::vector< State > m_states
Definition: AlgsExecutionStates.h:75
std::vector::begin
T begin(T...args)
gaudirun.s
string s
Definition: gaudirun.py:253
AlgsExecutionStates::State
State
Execution states of the algorithms.
Definition: AlgsExecutionStates.h:32

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

Definition at line 8 of file AlgsExecutionStates.cpp.

9 {
10
11 MsgStream log( m_MS, "AlgExecutionStates" );
12 const unsigned int states_size = m_states.size();
13
14 if ( iAlgo >= states_size ) {
15 log << MSG::ERROR << "Index out of bound (" << iAlgo << " and the size of the states vector is " << states_size
16 << ")" << endmsg;
17
18 return StatusCode::FAILURE;
19 }
20
21 switch ( newState ) {
22 case INITIAL:
23 log << MSG::ERROR << "[AlgIndex " << iAlgo << "] Transition to INITIAL is not defined.";
24 return StatusCode::FAILURE;
25 //
26 case CONTROLREADY:
27 if ( m_states[iAlgo] != INITIAL ) {
28 log << MSG::ERROR << "[AlgIndex " << iAlgo
29 << "] Transition to CONTROLREADY possible only from INITIAL state! The state is " << m_states[iAlgo]
30 << endmsg;
31 return StatusCode::FAILURE;
32 } else {
33 m_states[iAlgo] = CONTROLREADY;
34 return StatusCode::SUCCESS;
35 }
36 //
37 case DATAREADY:
38 if ( m_states[iAlgo] != CONTROLREADY ) {
39 log << MSG::ERROR << "[AlgIndex " << iAlgo
40 << "] Transition to DATAREADY possible only from CONTROLREADY state!The state is " << m_states[iAlgo]
41 << endmsg;
42 return StatusCode::FAILURE;
43 } else {
44 m_states[iAlgo] = DATAREADY;
45 return StatusCode::SUCCESS;
46 }
47 case SCHEDULED:
48 if ( m_states[iAlgo] != DATAREADY ) {
49 log << MSG::ERROR << "[AlgIndex " << iAlgo
50 << "] Transition to SCHEDULED possible only from DATAREADY state! The state is " << m_states[iAlgo] << endmsg;
51 return StatusCode::FAILURE;
52 } else {
53 m_states[iAlgo] = SCHEDULED;
54 return StatusCode::SUCCESS;
55 }
56 //
57 case EVTACCEPTED:
58 if ( m_states[iAlgo] != SCHEDULED ) {
59 log << MSG::ERROR << "[AlgIndex " << iAlgo
60 << "] Transition to EVTACCEPTED possible only from SCHEDULED state! The state is " << m_states[iAlgo]
61 << endmsg;
62 return StatusCode::FAILURE;
63 } else {
64 m_states[iAlgo] = EVTACCEPTED;
65 return StatusCode::SUCCESS;
66 }
67 //
68 case EVTREJECTED:
69 if ( m_states[iAlgo] != SCHEDULED ) {
70 log << MSG::ERROR << "[AlgIndex " << iAlgo
71 << "] Transition to EVTREJECT possible only from SCHEDULED state! The state is " << m_states[iAlgo] << endmsg;
72 return StatusCode::FAILURE;
73 } else {
74 m_states[iAlgo] = EVTREJECTED;
75 return StatusCode::SUCCESS;
76 }
77 default:
78 //
79 m_states[iAlgo] = ERROR;
80 return StatusCode::SUCCESS;
81 }
82
83 return StatusCode::FAILURE;
84 }
MsgStream
Definition of the MsgStream class used to transmit messages.
Definition: MsgStream.h:24
StatusCode::SUCCESS
Definition: StatusCode.h:31
AlgsExecutionStates::ERROR
Definition: AlgsExecutionStates.h:39
StatusCode::FAILURE
Definition: StatusCode.h:31
AlgsExecutionStates::SCHEDULED
Definition: AlgsExecutionStates.h:36
AlgsExecutionStates::EVTACCEPTED
Definition: AlgsExecutionStates.h:37
AlgsExecutionStates::INITIAL
Definition: AlgsExecutionStates.h:33
AlgsExecutionStates::m_MS
SmartIF< IMessageSvc > m_MS
Definition: AlgsExecutionStates.h:76
AlgsExecutionStates::CONTROLREADY
Definition: AlgsExecutionStates.h:34
std::vector::size
T size(T...args)
AlgsExecutionStates::m_states
std::vector< State > m_states
Definition: AlgsExecutionStates.h:75
AlgsExecutionStates::DATAREADY
Definition: AlgsExecutionStates.h:35
MSG::ERROR
Definition: IMessageSvc.h:16
AlgsExecutionStates::EVTREJECTED
Definition: AlgsExecutionStates.h:38
endmsg
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:209
Gaudi.Configuration.log
log
Definition: Configuration.py:13

## Member Data Documentation

SmartIF<IMessageSvc> AlgsExecutionStates::m_MS
| private

Definition at line 76 of file AlgsExecutionStates.h.

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

Definition at line 75 of file AlgsExecutionStates.h.

std::map< AlgsExecutionStates::State, std::string > AlgsExecutionStates::stateNames
| static

Initial value:
= {
{INITIAL, "INITIAL"}, {CONTROLREADY, "CONTROLREADY"}, {DATAREADY, "DATAREADY"}, {SCHEDULED, "SCHEDULED"},
{EVTACCEPTED, "EVTACCEPTED"}, {EVTREJECTED, "EVTREJECTED"}, {ERROR, "ERROR"}}

Definition at line 42 of file AlgsExecutionStates.h.

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

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