| The Gaudi Framework v32r1 (f65d50dc)

Enumerations | Functions
Gaudi::StateMachine Namespace Reference

## Enumerations
enum | State { OFFLINE, CONFIGURED, INITIALIZED, RUNNING }
| Allowed states for classes implementing the state machine (ApplicationMgr, Algorithm, Service, AlgTool). More...
enum | Transition { CONFIGURE, INITIALIZE, START, STOP, FINALIZE, TERMINATE }
| Allowed transitions between states. More...

## Functions
State GAUDI_API | ChangeState (const Transition transition, const State state)
| Function to get the new state according to the required transition, checking if the transition is allowed. More...
std::ostream & | operator<< (std::ostream &s, const Gaudi::StateMachine::State &st)
| Pretty print of states. More...
std::ostream & | operator<< (std::ostream &s, const Gaudi::StateMachine::Transition &t)
| Pretty print of transitions. More...

## Enumeration Type Documentation

## ◆ State

enum Gaudi::StateMachine::State

Allowed states for classes implementing the state machine (ApplicationMgr, Algorithm, Service, AlgTool).

Enumerator
OFFLINE |
CONFIGURED |
INITIALIZED |
RUNNING |

Definition at line 12 of file StateMachine.h.

12 {
13 OFFLINE,
14 CONFIGURED,
15 INITIALIZED,
16 RUNNING //,
17 // FINALIZED = CONFIGURED
18 };
Gaudi::StateMachine::INITIALIZED
Definition: StateMachine.h:15
Gaudi::StateMachine::CONFIGURED
Definition: StateMachine.h:14
Gaudi::StateMachine::RUNNING
Definition: StateMachine.h:16
Gaudi::StateMachine::OFFLINE
Definition: StateMachine.h:13

## ◆ Transition

enum Gaudi::StateMachine::Transition

Allowed transitions between states.

Enumerator
CONFIGURE |
INITIALIZE |
START |
STOP |
FINALIZE |
TERMINATE |

Definition at line 23 of file StateMachine.h.

23 {
24 CONFIGURE, // OFFLINE -> CONFIGURED
25 INITIALIZE, // CONFIGURED -> INITIALIZED
26 START, // INITIALIZED -> RUNNING
27 STOP, // RUNNING -> INITIALIZED
28 FINALIZE, // INITIALIZED -> CONFIGURED
29 TERMINATE // CONFIGURED -> OFFLINE
30 };
Gaudi::StateMachine::FINALIZE
Definition: StateMachine.h:28
Gaudi::StateMachine::CONFIGURE
Definition: StateMachine.h:24
Gaudi::StateMachine::INITIALIZE
Definition: StateMachine.h:25
Gaudi::StateMachine::STOP
Definition: StateMachine.h:27
Gaudi::StateMachine::TERMINATE
Definition: StateMachine.h:29
Gaudi::StateMachine::START
Definition: StateMachine.h:26

## Function Documentation

## ◆ ChangeState()

State Gaudi::StateMachine::ChangeState | ( | const Transition | transition,
|  | const State | state
| ) |  |

Function to get the new state according to the required transition, checking if the transition is allowed.

Definition at line 9 of file StateMachine.cpp.

9 {
10 switch ( transition ) {
11 case CONFIGURE:
12 if ( OFFLINE == state ) { return CONFIGURED; }
13 break;
14 case INITIALIZE:
15 if ( CONFIGURED == state ) { return INITIALIZED; }
16 break;
17 case START:
18 if ( INITIALIZED == state ) { return RUNNING; }
19 break;
20 case STOP:
21 if ( RUNNING == state ) { return INITIALIZED; }
22 break;
23 case FINALIZE:
24 if ( INITIALIZED == state ) { return CONFIGURED; }
25 break;
26 case TERMINATE:
27 if ( CONFIGURED == state ) { return OFFLINE; }
28 break;
29 default:
30 break;
31 }
32 std::stringstream msg;
33 msg << "Invalid transition '" << transition << "' from state '" << state << "'";
34 throw GaudiException( msg.str(), "Gaudi::StateMachine::ChangeState", StatusCode( StatusCode::FAILURE, true ) );
35 return OFFLINE; // never reached, but maked the compiler happy
36 }
Gaudi::StateMachine::INITIALIZED
Definition: StateMachine.h:15
GaudiException
Define general base for Gaudi exception.
Definition: GaudiException.h:21
Gaudi::StateMachine::CONFIGURED
Definition: StateMachine.h:14
Gaudi::StateMachine::FINALIZE
Definition: StateMachine.h:28
std::stringstream
STL class.
Gaudi::StateMachine::CONFIGURE
Definition: StateMachine.h:24
Gaudi::StateMachine::INITIALIZE
Definition: StateMachine.h:25
StatusCode
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:50
compareRootHistos.state
def state
Definition: compareRootHistos.py:455
Gaudi::StateMachine::STOP
Definition: StateMachine.h:27
Gaudi::StateMachine::RUNNING
Definition: StateMachine.h:16
Gaudi::StateMachine::TERMINATE
Definition: StateMachine.h:29
GaudiMP.FdsRegistry.msg
msg
Definition: FdsRegistry.py:8
Gaudi::StateMachine::START
Definition: StateMachine.h:26
StatusCode::FAILURE
constexpr static const auto FAILURE
Definition: StatusCode.h:86
Gaudi::StateMachine::OFFLINE
Definition: StateMachine.h:13

## ◆ operator<<() [1/2]

std::ostream& Gaudi::StateMachine::operator<< | ( | std::ostream & | s,
|  | const Gaudi::StateMachine::State & | st
| ) |  |
| inline

Pretty print of states.

Definition at line 39 of file StateMachine.h.

39 {
40 switch ( st ) {
41 case Gaudi::StateMachine::OFFLINE:
42 return s << "OFFLINE";
43 case Gaudi::StateMachine::CONFIGURED:
44 return s << "CONFIGURED";
45 case Gaudi::StateMachine::INITIALIZED:
46 return s << "INITIALIZED";
47 case Gaudi::StateMachine::RUNNING:
48 return s << "RUNNING";
49 default:
50 return s;
51 }
52 }
Gaudi::StateMachine::INITIALIZED
Definition: StateMachine.h:15
Gaudi::StateMachine::CONFIGURED
Definition: StateMachine.h:14
Gaudi::StateMachine::RUNNING
Definition: StateMachine.h:16
gaudirun.s
string s
Definition: gaudirun.py:316
Gaudi::StateMachine::OFFLINE
Definition: StateMachine.h:13

## ◆ operator<<() [2/2]

std::ostream& Gaudi::StateMachine::operator<< | ( | std::ostream & | s,
|  | const Gaudi::StateMachine::Transition & | t
| ) |  |
| inline

Pretty print of transitions.

Definition at line 55 of file StateMachine.h.

55 {
56 switch ( t ) {
57 case Gaudi::StateMachine::CONFIGURE:
58 return s << "CONFIGURE";
59 case Gaudi::StateMachine::INITIALIZE:
60 return s << "INITIALIZE";
61 case Gaudi::StateMachine::START:
62 return s << "START";
63 case Gaudi::StateMachine::STOP:
64 return s << "STOP";
65 case Gaudi::StateMachine::FINALIZE:
66 return s << "FINALIZE";
67 case Gaudi::StateMachine::TERMINATE:
68 return s << "TERMINATE";
69 default:
70 return s;
71 }
72 }
Gaudi::StateMachine::FINALIZE
Definition: StateMachine.h:28
Gaudi::StateMachine::CONFIGURE
Definition: StateMachine.h:24
Gaudi::StateMachine::INITIALIZE
Definition: StateMachine.h:25
Gaudi::StateMachine::STOP
Definition: StateMachine.h:27
Gaudi::StateMachine::TERMINATE
Definition: StateMachine.h:29
gaudirun.s
string s
Definition: gaudirun.py:316
Gaudi::StateMachine::START
Definition: StateMachine.h:26