| The Gaudi Framework v32r1 (f65d50dc)

StateMachine.cpp
Go to the documentation of this file.
1 #include "GaudiKernel/StateMachine.h"
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 }
32 std::stringstream msg;
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
Gaudi::StateMachine::INITIALIZED
Definition: StateMachine.h:15
GaudiException
Define general base for Gaudi exception.
Definition: GaudiException.h:21
Gaudi::StateMachine::CONFIGURED
Definition: StateMachine.h:14
Gaudi::StateMachine::FINALIZE
Definition: StateMachine.h:28
Gaudi::StateMachine::State
State
Allowed states for classes implementing the state machine (ApplicationMgr, Algorithm,...
Definition: StateMachine.h:12
std::stringstream
STL class.
Gaudi::StateMachine::CONFIGURE
Definition: StateMachine.h:24
Gaudi::StateMachine::INITIALIZE
Definition: StateMachine.h:25
StatusCode
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:50
compareRootHistos.state
def state
Definition: compareRootHistos.py:455
Gaudi::StateMachine::STOP
Definition: StateMachine.h:27
Gaudi::StateMachine::RUNNING
Definition: StateMachine.h:16
Gaudi::StateMachine::ChangeState
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
Gaudi::StateMachine::TERMINATE
Definition: StateMachine.h:29
Gaudi::StateMachine::Transition
Transition
Allowed transitions between states.
Definition: StateMachine.h:23
GaudiMP.FdsRegistry.msg
msg
Definition: FdsRegistry.py:8
Gaudi::StateMachine::START
Definition: StateMachine.h:26
StatusCode::FAILURE
constexpr static const auto FAILURE
Definition: StatusCode.h:86
Gaudi::StateMachine::OFFLINE
Definition: StateMachine.h:13
StateMachine.h
Gaudi
Header file for std:chrono::duration-based Counters.
Definition: __init__.py:1