The Gaudi Framework  v29r0 (ff2e7097)
StateMachine.h
Go to the documentation of this file.
1 #ifndef GAUDIKERNEL_STATEMACHINE_H_
2 #define GAUDIKERNEL_STATEMACHINE_H_
3 
5 
6 namespace Gaudi
7 {
8  namespace StateMachine
9  {
14  enum State {
18  RUNNING //,
19  // FINALIZED = CONFIGURED
20  };
21 
25  enum Transition {
26  CONFIGURE, // OFFLINE -> CONFIGURED
27  INITIALIZE, // CONFIGURED -> INITIALIZED
28  START, // INITIALIZED -> RUNNING
29  STOP, // RUNNING -> INITIALIZED
30  FINALIZE, // INITIALIZED -> CONFIGURED
31  TERMINATE // CONFIGURED -> OFFLINE
32  };
33 
38  State GAUDI_API ChangeState( const Transition transition, const State state );
39 
42  {
43  switch ( st ) {
45  return s << "OFFLINE";
47  return s << "CONFIGURED";
49  return s << "INITIALIZED";
51  return s << "RUNNING";
52  }
53  return s; // cannot be reached, but make the compiler happy
54  }
55 
58  {
59  switch ( t ) {
61  return s << "CONFIGURE";
63  return s << "INITIALIZE";
65  return s << "START";
67  return s << "STOP";
69  return s << "FINALIZE";
71  return s << "TERMINATE";
72  }
73  return s; // cannot be reached, but make the compiler happy
74  }
75 
76  } // namespace StateMachine
77 } // namespace Gaudi
78 
79 #endif /*GAUDIKERNEL_STATEMACHINE_H_*/
std::ostream & operator<<(std::ostream &s, const Gaudi::StateMachine::State &st)
Pretty print of states.
Definition: StateMachine.h:41
State
Allowed states for classes implementing the state machine (ApplicationMgr, Algorithm, Service, AlgTool).
Definition: StateMachine.h:14
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...
Transition
Allowed transitions between states.
Definition: StateMachine.h:25
string s
Definition: gaudirun.py:253
#define GAUDI_API
Definition: Kernel.h:110
STL class.
Helper functions to set/get the application return code.
Definition: __init__.py:1