Loading [MathJax]/extensions/tex2jax.js
The Gaudi Framework  v31r0 (aeb156f0)
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 {
4  namespace StateMachine {
9  State ChangeState( const Transition transition, const State state ) {
10  switch ( transition ) {
11  case CONFIGURE:
12  if ( OFFLINE == state ) { return CONFIGURED; }
13  break;
14  case INITIALIZE:
15  if ( CONFIGURED == state ) { return INITIALIZED; }
16  break;
17  case START:
18  if ( INITIALIZED == state ) { return RUNNING; }
19  break;
20  case STOP:
21  if ( RUNNING == state ) { return INITIALIZED; }
22  break;
23  case FINALIZE:
24  if ( INITIALIZED == state ) { return CONFIGURED; }
25  break;
26  case TERMINATE:
27  if ( CONFIGURED == state ) { return OFFLINE; }
28  break;
29  default:
30  break;
31  }
33  msg << "Invalid transition '" << transition << "' from state '" << state << "'";
34  throw GaudiException( msg.str(), "Gaudi::StateMachine::ChangeState", StatusCode( StatusCode::FAILURE, true ) );
35  return OFFLINE; // never reached, but maked the compiler happy
36  }
37  } // namespace StateMachine
38 } // namespace Gaudi
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:50
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:9
Transition
Allowed transitions between states.
Definition: StateMachine.h:23
constexpr static const auto FAILURE
Definition: StatusCode.h:86
Helper functions to set/get the application return code.
Definition: __init__.py:1