| # Gaudi Framework, version v25r0 |

Home |  | Generated: Mon Feb 17 2014

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

- Namespace List
- Namespace Members

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
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.
std::ostream & | operator<< (std::ostream &s, const Gaudi::StateMachine::State &st)
| Pretty print of states.
std::ostream & | operator<< (std::ostream &s, const Gaudi::StateMachine::Transition &t)
| Pretty print of transitions.

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

{
OFFLINE,
CONFIGURED,
INITIALIZED,
RUNNING//,
//FINALIZED = CONFIGURED
};

enum Gaudi::StateMachine::Transition

Allowed transitions between states.

Enumerator:

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

Definition at line 23 of file StateMachine.h.

{
CONFIGURE, // OFFLINE -> CONFIGURED
INITIALIZE, // CONFIGURED -> INITIALIZED
START, // INITIALIZED -> RUNNING
STOP, // RUNNING -> INITIALIZED
FINALIZE, // INITIALIZED -> CONFIGURED
TERMINATE // CONFIGURED -> OFFLINE
};

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

{
switch (transition) {
case CONFIGURE:
if ( OFFLINE == state ) {
return CONFIGURED;
}
break;
case INITIALIZE:
if ( CONFIGURED == state ) {
return INITIALIZED;
}
break;
case START:
if ( INITIALIZED == state ) {
return RUNNING;
}
break;
case STOP:
if ( RUNNING == state ) {
return INITIALIZED;
}
break;
case FINALIZE:
if ( INITIALIZED == state ) {
return CONFIGURED;
}
break;
case TERMINATE:
if ( CONFIGURED == state ) {
return OFFLINE;
}
break;
}
std::stringstream msg;
msg << "Invalid transition '" << transition << "' from state '" << state << "'";
throw GaudiException(msg.str(), "Gaudi::StateMachine::ChangeState",
StatusCode(StatusCode::FAILURE,true));
return OFFLINE; // never reached, but maked the compiler happy
}

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.

{
switch (st) {
case Gaudi::StateMachine::OFFLINE : return s << "OFFLINE";
case Gaudi::StateMachine::CONFIGURED : return s << "CONFIGURED";
case Gaudi::StateMachine::INITIALIZED : return s << "INITIALIZED";
case Gaudi::StateMachine::RUNNING : return s << "RUNNING";
}
return s; // cannot be reached, but make the compiler happy
}

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.

{
switch (t) {
case Gaudi::StateMachine::CONFIGURE : return s << "CONFIGURE";
case Gaudi::StateMachine::INITIALIZE : return s << "INITIALIZE";
case Gaudi::StateMachine::START : return s << "START";
case Gaudi::StateMachine::STOP : return s << "STOP";
case Gaudi::StateMachine::FINALIZE : return s << "FINALIZE";
case Gaudi::StateMachine::TERMINATE : return s << "TERMINATE";
}
return s; // cannot be reached, but make the compiler happy
}