| The Gaudi Framework v28r2p1 (f1a77ff4)

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

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

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

8 {
9 switch (transition) {
10 case CONFIGURE:
11 if ( OFFLINE == state ) {
12 return CONFIGURED;
13 }
14 break;
15 case INITIALIZE:
16 if ( CONFIGURED == state ) {
17 return INITIALIZED;
18 }
19 break;
20 case START:
21 if ( INITIALIZED == state ) {
22 return RUNNING;
23 }
24 break;
25 case STOP:
26 if ( RUNNING == state ) {
27 return INITIALIZED;
28 }
29 break;
30 case FINALIZE:
31 if ( INITIALIZED == state ) {
32 return CONFIGURED;
33 }
34 break;
35 case TERMINATE:
36 if ( CONFIGURED == state ) {
37 return OFFLINE;
38 }
39 break;
40 }
41 std::stringstream msg;
42 msg << "Invalid transition '" << transition << "' from state '" << state << "'";
43 throw GaudiException(msg.str(), "Gaudi::StateMachine::ChangeState",
44 StatusCode(StatusCode::FAILURE,true));
45 return OFFLINE; // never reached, but maked the compiler happy
46 }
Gaudi::StateMachine::INITIALIZED
Definition: StateMachine.h:15
GaudiException
Define general base for Gaudi exception.
Definition: GaudiException.h:23
Gaudi::StateMachine::CONFIGURED
Definition: StateMachine.h:14
StatusCode::FAILURE
Definition: StatusCode.h:29
compareRootHistos.state
state
Definition: compareRootHistos.py:348
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:26
std::stringstream::str
T str(T...args)
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
Gaudi::StateMachine::OFFLINE
Definition: StateMachine.h:13

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 : return s << "OFFLINE";
42 case Gaudi::StateMachine::CONFIGURED : return s << "CONFIGURED";
43 case Gaudi::StateMachine::INITIALIZED : return s << "INITIALIZED";
44 case Gaudi::StateMachine::RUNNING : return s << "RUNNING";
45 }
46 return s; // cannot be reached, but make the compiler happy
47 }
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:245
Gaudi::StateMachine::OFFLINE
Definition: StateMachine.h:13

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

Pretty print of transitions.

Definition at line 50 of file StateMachine.h.

50 {
51 switch (t) {
52 case Gaudi::StateMachine::CONFIGURE : return s << "CONFIGURE";
53 case Gaudi::StateMachine::INITIALIZE : return s << "INITIALIZE";
54 case Gaudi::StateMachine::START : return s << "START";
55 case Gaudi::StateMachine::STOP : return s << "STOP";
56 case Gaudi::StateMachine::FINALIZE : return s << "FINALIZE";
57 case Gaudi::StateMachine::TERMINATE : return s << "TERMINATE";
58 }
59 return s; // cannot be reached, but make the compiler happy
60 }
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:245
Gaudi::StateMachine::START
Definition: StateMachine.h:26