|
Gaudi Framework, version v23r0 |
| Home | Generated: Mon Jan 30 2012 |
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. | |
Allowed states for classes implementing the state machine (ApplicationMgr, Algorithm, Service, AlgTool).
Definition at line 12 of file StateMachine.h.
{
OFFLINE,
CONFIGURED,
INITIALIZED,
RUNNING//,
//FINALIZED = CONFIGURED
};
Allowed transitions between states.
Definition at line 23 of file StateMachine.h.
| 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
}