| The Gaudi Framework v28r2-patches (bc4ad17a)

- 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.

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

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

Definition at line 48 of file AlgsExecutionStates.h.

48 {};

## Member Function Documentation

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

Definition at line 54 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:348
std::vector::end
T end(T...args)
std::find
T find(T...args)
AlgsExecutionStates::m_states
std::vector< State > m_states
Definition: AlgsExecutionStates.h:78
std::vector::begin
T begin(T...args)

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

Definition at line 58 of file AlgsExecutionStates.h.

58 {
59 int execAlgos=std::count_if(m_states.begin(),m_states.end(),[](State s) {return (s == EVTACCEPTED || s== EVTREJECTED);});
60 return m_states.size() == (unsigned int)execAlgos;
61 };
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:78
std::vector::begin
T begin(T...args)
gaudirun.s
string s
Definition: gaudirun.py:245
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 135 of file AlgsExecutionStates.h.

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

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

Definition at line 140 of file AlgsExecutionStates.h.

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

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

Definition at line 63 of file AlgsExecutionStates.h.

63 {
64
65 return m_states.at(i);
66
67 };
std::vector::at
T at(T...args)
AlgsExecutionStates::m_states
std::vector< State > m_states
Definition: AlgsExecutionStates.h:78

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

Definition at line 52 of file AlgsExecutionStates.h.

52 {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:78

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

Definition at line 69 of file AlgsExecutionStates.h.

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

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

Definition at line 73 of file AlgsExecutionStates.h.

73 {
74 return std::count_if(m_states.begin(),m_states.end(),[&](State s) {return (s == state);});
75 }
compareRootHistos.state
state
Definition: compareRootHistos.py:348
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:78
std::vector::begin
T begin(T...args)
gaudirun.s
string s
Definition: gaudirun.py:245
AlgsExecutionStates::State
State
Execution states of the algorithms.
Definition: AlgsExecutionStates.h:32

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

Definition at line 14 of file AlgsExecutionStates.cpp.

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

## Member Data Documentation

SmartIF<IMessageSvc> AlgsExecutionStates::m_MS
| private

Definition at line 79 of file AlgsExecutionStates.h.

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

Definition at line 78 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