All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
StateMachine.cpp
Go to the documentation of this file.
2 
3 namespace Gaudi { namespace StateMachine {
8 State ChangeState(const Transition transition, const State state) {
9  switch (transition) {
10  case CONFIGURE:
11  if ( OFFLINE == state ) {
12  return CONFIGURED;
13  }
14  break;
15  case INITIALIZE:
16  if ( CONFIGURED == state ) {
17  return INITIALIZED;
18  }
19  break;
20  case START:
21  if ( INITIALIZED == state ) {
22  return RUNNING;
23  }
24  break;
25  case STOP:
26  if ( RUNNING == state ) {
27  return INITIALIZED;
28  }
29  break;
30  case FINALIZE:
31  if ( INITIALIZED == state ) {
32  return CONFIGURED;
33  }
34  break;
35  case TERMINATE:
36  if ( CONFIGURED == state ) {
37  return OFFLINE;
38  }
39  break;
40  }
42  msg << "Invalid transition '" << transition << "' from state '" << state << "'";
43  throw GaudiException(msg.str(), "Gaudi::StateMachine::ChangeState",
45  return OFFLINE; // never reached, but maked the compiler happy
46 }
47 
48 } } // namespace Gaudi::StateMachine
Define general base for Gaudi exception.
State
Allowed states for classes implementing the state machine (ApplicationMgr, Algorithm, Service, AlgTool).
Definition: StateMachine.h:12
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:26
T str(T...args)
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 all...
Definition: StateMachine.cpp:8
Transition
Allowed transitions between states.
Definition: StateMachine.h:23
Helper functions to set/get the application return code.
Definition: __init__.py:1