|
Gaudi Framework, version v22r0 |
| Home | Generated: 9 Feb 2011 |
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.
00012 { 00013 OFFLINE, 00014 CONFIGURED, 00015 INITIALIZED, 00016 RUNNING//, 00017 //FINALIZED = CONFIGURED 00018 };
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.
00008 { 00009 switch (transition) { 00010 case CONFIGURE: 00011 if ( OFFLINE == state ) { 00012 return CONFIGURED; 00013 } 00014 break; 00015 case INITIALIZE: 00016 if ( CONFIGURED == state ) { 00017 return INITIALIZED; 00018 } 00019 break; 00020 case START: 00021 if ( INITIALIZED == state ) { 00022 return RUNNING; 00023 } 00024 break; 00025 case STOP: 00026 if ( RUNNING == state ) { 00027 return INITIALIZED; 00028 } 00029 break; 00030 case FINALIZE: 00031 if ( INITIALIZED == state ) { 00032 return CONFIGURED; 00033 } 00034 break; 00035 case TERMINATE: 00036 if ( CONFIGURED == state ) { 00037 return OFFLINE; 00038 } 00039 break; 00040 } 00041 std::stringstream msg; 00042 msg << "Invalid transition '" << transition << "' from state '" << state << "'"; 00043 throw GaudiException(msg.str(), "Gaudi::StateMachine::ChangeState", 00044 StatusCode(StatusCode::FAILURE,true)); 00045 return OFFLINE; // never reached, but maked the compiler happy 00046 }