| # Gaudi Framework, version v21r11 |

Home |  | Generated: 30 Sep 2010

# StateMachine.h

Go to the documentation of this file.

    00001 #ifndef GAUDIKERNEL_STATEMACHINE_H_
    00002 #define GAUDIKERNEL_STATEMACHINE_H_
    00003
    00004 #include "GaudiKernel/GaudiException.h"
    00005
    00006 namespace Gaudi {
    00007 namespace StateMachine {
    00012 enum State {
    00013   OFFLINE,
    00014   CONFIGURED,
    00015   INITIALIZED,
    00016   RUNNING//,
    00017   //FINALIZED = CONFIGURED
    00018 };
    00019
    00023 enum Transition {
    00024   CONFIGURE,  // OFFLINE     -> CONFIGURED
    00025   INITIALIZE, // CONFIGURED  -> INITIALIZED
    00026   START,      // INITIALIZED -> RUNNING
    00027   STOP,       // RUNNING     -> INITIALIZED
    00028   FINALIZE,   // INITIALIZED -> CONFIGURED
    00029   TERMINATE   // CONFIGURED  -> OFFLINE
    00030 };
    00031
    00036 State GAUDI_API ChangeState(const Transition transition, const State state);
    00037
    00038 } // namespace Gaudi
    00039 } // namespace StateMachine
    00040
    00042 inline std::ostream & operator << (std::ostream & s, const Gaudi::StateMachine::State &st) {
    00043   switch (st) {
    00044   case Gaudi::StateMachine::OFFLINE     : return s << "OFFLINE";
    00045   case Gaudi::StateMachine::CONFIGURED  : return s << "CONFIGURED";
    00046   case Gaudi::StateMachine::INITIALIZED : return s << "INITIALIZED";
    00047   case Gaudi::StateMachine::RUNNING     : return s << "RUNNING";
    00048   }
    00049   return s; // cannot be reached, but make the compiler happy
    00050 }
    00051
    00053 inline std::ostream & operator << (std::ostream & s, const Gaudi::StateMachine::Transition &t) {
    00054   switch (t) {
    00055   case Gaudi::StateMachine::CONFIGURE  : return s << "CONFIGURE";
    00056   case Gaudi::StateMachine::INITIALIZE : return s << "INITIALIZE";
    00057   case Gaudi::StateMachine::START      : return s << "START";
    00058   case Gaudi::StateMachine::STOP       : return s << "STOP";
    00059   case Gaudi::StateMachine::FINALIZE   : return s << "FINALIZE";
    00060   case Gaudi::StateMachine::TERMINATE  : return s << "TERMINATE";
    00061   }
    00062   return s; // cannot be reached, but make the compiler happy
    00063 }
    00064
    00065 #endif /*GAUDIKERNEL_STATEMACHINE_H_*/