otsdaq  v1_01_02
 All Classes Namespaces Functions
RunControlStateMachine.h
1 #ifndef _ots_RunControlStateMachine_h_
2 #define _ots_RunControlStateMachine_h_
3 
4 #include "otsdaq-core/FiniteStateMachine/FiniteStateMachine.h"
5 #include "otsdaq-core/ProgressBar/ProgressBar.h"
6 
7 #include "toolbox/lang/Class.h"
8 #include <string>
9 
10 
11 namespace ots
12 {
13 
14 class RunControlStateMachine : public virtual toolbox::lang::Class
15 {
16 
17 public:
18 
19  RunControlStateMachine(std::string name="Undefined Name");
20  virtual ~RunControlStateMachine(void);
21 
22  void reset(void);
23  void setStateMachineName(std::string name){stateMachineName_ = name;}
24 
25  //Finite State Machine States
26  //1. Control Configuration and Function Manager are loaded.
27  virtual void stateInitial (toolbox::fsm::FiniteStateMachine& fsm) throw (toolbox::fsm::exception::Exception){;}
28 
29  //1. XDAQ applications are running.
30  //2. Hardware is running.
31  //3. Triggers are accepted.
32  //4. Triggers are not sent.
33  //5. Data is sent / read out.
34  virtual void statePaused (toolbox::fsm::FiniteStateMachine& fsm) throw (toolbox::fsm::exception::Exception){;}
35 
36  //1. XDAQ applications are running.
37  //2. Hardware is running.
38  //3. Triggers are accepted.
39  //4. Triggers are sent.
40  //5. Data is sent / read out.
41  virtual void stateRunning (toolbox::fsm::FiniteStateMachine& fsm) throw (toolbox::fsm::exception::Exception){;}
42 
43  //1. Control hierarchy is instantiated.
44  //2. XDAQ executives are running and configured.
45  //3. XDAQ applications are loaded and instantiated.
46  //4. DCS nodes are allocated.
47  virtual void stateHalted (toolbox::fsm::FiniteStateMachine& fsm) throw (toolbox::fsm::exception::Exception){;}
48 
49  //1. XDAQ applications are configured.
50  //2. Run parameters have been distributed.
51  //3. Hardware is configured.
52  //4. I2O connections are established, no data is sent or read out.
53  //5. Triggers are not sent.
54  virtual void stateConfigured (toolbox::fsm::FiniteStateMachine& fsm) throw (toolbox::fsm::exception::Exception){;}
55 
56  virtual void inError (toolbox::fsm::FiniteStateMachine& fsm) throw (toolbox::fsm::exception::Exception){;}
57 
58  virtual void transitionConfiguring (toolbox::Event::Reference e) throw (toolbox::fsm::exception::Exception){;}
59  virtual void transitionHalting (toolbox::Event::Reference e) throw (toolbox::fsm::exception::Exception){;}
60  virtual void transitionInitializing(toolbox::Event::Reference e) throw (toolbox::fsm::exception::Exception){;}
61  virtual void transitionPausing (toolbox::Event::Reference e) throw (toolbox::fsm::exception::Exception){;}
62  virtual void transitionResuming (toolbox::Event::Reference e) throw (toolbox::fsm::exception::Exception){;}
63  virtual void transitionStarting (toolbox::Event::Reference e) throw (toolbox::fsm::exception::Exception){;}
64  virtual void transitionStopping (toolbox::Event::Reference e) throw (toolbox::fsm::exception::Exception){;}
65  virtual void enteringError (toolbox::Event::Reference e) throw (toolbox::fsm::exception::Exception){;}
66 
67  //Run Control Messages
68  xoap::MessageReference runControlMessageHandler(xoap::MessageReference message) throw (xoap::exception::Exception);
69 
70 protected:
71  FiniteStateMachine theStateMachine_;
72  ProgressBar theProgressBar_;
73  std::string stateMachineName_;
74 };
75 
76 }
77 
78 #endif
79