| # Gaudi Framework, version v20r2
Generated: 18 Jul 2008

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

- Search for |

- File List
- File Members

# StateMachine.cpp

Go to the documentation of this file.

    00001 #include "GaudiKernel/StateMachine.h"
    00002
    00003 namespace Gaudi { namespace StateMachine {
    00008 State ChangeState(const Transition transition, const State state) {
    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 }
    00047
    00048 } } // namespace Gaudi::StateMachine