| # Gaudi Framework, version v22r2 |

Home |  | Generated: Tue May 10 2011

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.

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

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Defines