| The Gaudi Framework v29r0 (ff2e7097)

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

- Namespace List
- Namespace Members

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

enum Gaudi::StateMachine::State

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

Enumerator
OFFLINE |
CONFIGURED |
INITIALIZED |
RUNNING |

Definition at line 14 of file StateMachine.h.

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

enum Gaudi::StateMachine::Transition

Allowed transitions between states.

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

Definition at line 25 of file StateMachine.h.

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

## Function Documentation

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 11 of file StateMachine.cpp.

12 {
13 switch ( transition ) {
14 case CONFIGURE:
15 if ( OFFLINE == state ) {
16 return CONFIGURED;
17 }
18 break;
19 case INITIALIZE:
20 if ( CONFIGURED == state ) {
21 return INITIALIZED;
22 }
23 break;
24 case START:
25 if ( INITIALIZED == state ) {
26 return RUNNING;
27 }
28 break;
29 case STOP:
30 if ( RUNNING == state ) {
31 return INITIALIZED;
32 }
33 break;
34 case FINALIZE:
35 if ( INITIALIZED == state ) {
36 return CONFIGURED;
37 }
38 break;
39 case TERMINATE:
40 if ( CONFIGURED == state ) {
41 return OFFLINE;
42 }
43 break;
44 }
45 std::stringstream msg;
46 msg << "Invalid transition '" << transition << "' from state '" << state << "'";
47 throw GaudiException( msg.str(), "Gaudi::StateMachine::ChangeState", StatusCode( StatusCode::FAILURE, true ) );
48 return OFFLINE; // never reached, but maked the compiler happy
49 }
Gaudi::StateMachine::INITIALIZED
Definition: StateMachine.h:17
GaudiException
Define general base for Gaudi exception.
Definition: GaudiException.h:22
Gaudi::StateMachine::CONFIGURED
Definition: StateMachine.h:16
StatusCode::FAILURE
Definition: StatusCode.h:31
compareRootHistos.state
state
Definition: compareRootHistos.py:422
Gaudi::StateMachine::FINALIZE
Definition: StateMachine.h:30
std::stringstream
STL class.
Gaudi::StateMachine::CONFIGURE
Definition: StateMachine.h:26
Gaudi::StateMachine::INITIALIZE
Definition: StateMachine.h:27
StatusCode
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:28
std::stringstream::str
T str(T...args)
Gaudi::StateMachine::STOP
Definition: StateMachine.h:29
Gaudi::StateMachine::RUNNING
Definition: StateMachine.h:18
Gaudi::StateMachine::TERMINATE
Definition: StateMachine.h:31
GaudiMP.FdsRegistry.msg
msg
Definition: FdsRegistry.py:8
Gaudi::StateMachine::START
Definition: StateMachine.h:28
Gaudi::StateMachine::OFFLINE
Definition: StateMachine.h:15

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

Pretty print of states.

Definition at line 41 of file StateMachine.h.

42 {
43 switch ( st ) {
44 case Gaudi::StateMachine::OFFLINE:
45 return s << "OFFLINE";
46 case Gaudi::StateMachine::CONFIGURED:
47 return s << "CONFIGURED";
48 case Gaudi::StateMachine::INITIALIZED:
49 return s << "INITIALIZED";
50 case Gaudi::StateMachine::RUNNING:
51 return s << "RUNNING";
52 }
53 return s; // cannot be reached, but make the compiler happy
54 }
Gaudi::StateMachine::INITIALIZED
Definition: StateMachine.h:17
Gaudi::StateMachine::CONFIGURED
Definition: StateMachine.h:16
Gaudi::StateMachine::RUNNING
Definition: StateMachine.h:18
gaudirun.s
string s
Definition: gaudirun.py:253
Gaudi::StateMachine::OFFLINE
Definition: StateMachine.h:15

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

Pretty print of transitions.

Definition at line 57 of file StateMachine.h.

58 {
59 switch ( t ) {
60 case Gaudi::StateMachine::CONFIGURE:
61 return s << "CONFIGURE";
62 case Gaudi::StateMachine::INITIALIZE:
63 return s << "INITIALIZE";
64 case Gaudi::StateMachine::START:
65 return s << "START";
66 case Gaudi::StateMachine::STOP:
67 return s << "STOP";
68 case Gaudi::StateMachine::FINALIZE:
69 return s << "FINALIZE";
70 case Gaudi::StateMachine::TERMINATE:
71 return s << "TERMINATE";
72 }
73 return s; // cannot be reached, but make the compiler happy
74 }
Gaudi::StateMachine::FINALIZE
Definition: StateMachine.h:30
Gaudi::StateMachine::CONFIGURE
Definition: StateMachine.h:26
Gaudi::StateMachine::INITIALIZE
Definition: StateMachine.h:27
Gaudi::StateMachine::STOP
Definition: StateMachine.h:29
Gaudi::StateMachine::TERMINATE
Definition: StateMachine.h:31
gaudirun.s
string s
Definition: gaudirun.py:253
Gaudi::StateMachine::START
Definition: StateMachine.h:28