otsdaq  v1_01_02
 All Classes Namespaces Functions
CoreSupervisorBase.h
1 #ifndef _ots_CoreSupervisorBase_h_
2 #define _ots_CoreSupervisorBase_h_
3 
4 #include "otsdaq-core/WorkLoopManager/WorkLoopManager.h"
5 #include "otsdaq-core/FiniteStateMachine/RunControlStateMachine.h"
6 #include "otsdaq-core/Supervisor/SupervisorsInfo.h"
7 #include "otsdaq-core/SOAPUtilities/SOAPMessenger.h"
8 #include "otsdaq-core/SupervisorDescriptorInfo/SupervisorDescriptorInfo.h"
9 #pragma GCC diagnostic push
10 #pragma GCC diagnostic ignored "-Wdeprecated-declarations"
11 #include <xdaq/Application.h>
12 #pragma GCC diagnostic pop
13 #include "xgi/Method.h"
14 
15 #include <string>
16 #include <memory>
17 #include <vector>
18 
19 
20 namespace ots
21 {
22 
23 class ConfigurationManager;
24 class VStateMachine;
25 class FEVInterfacesManager;
26 
27 class CoreSupervisorBase: public xdaq::Application, public SOAPMessenger, public RunControlStateMachine
28 {
29 
30 public:
31 
32  CoreSupervisorBase (xdaq::ApplicationStub * s) throw (xdaq::exception::Exception);
33  virtual ~CoreSupervisorBase(void);
34  void init (void);
35  void destroy (void);
36  void Default (xgi::Input* in, xgi::Output* out) throw (xgi::exception::Exception);
37  void request (xgi::Input* in, xgi::Output* out) throw (xgi::exception::Exception);
38 
39  //State Machine requests handlers
40  void stateMachineXgiHandler (xgi::Input* in, xgi::Output* out ) throw (xgi::exception::Exception);
41  void stateMachineResultXgiHandler (xgi::Input* in, xgi::Output* out ) throw (xgi::exception::Exception);
42  xoap::MessageReference stateMachineXoapHandler (xoap::MessageReference message ) throw (xoap::exception::Exception);
43  xoap::MessageReference stateMachineResultXoapHandler(xoap::MessageReference message ) throw (xoap::exception::Exception);
44 
45  xoap::MessageReference stateMachineStateRequest (xoap::MessageReference message ) throw (xoap::exception::Exception);
46  xoap::MessageReference macroMakerSupervisorRequest (xoap::MessageReference message ) throw (xoap::exception::Exception);
47 
48  bool stateMachineThread (toolbox::task::WorkLoop* workLoop);
49 
50  virtual void stateInitial (toolbox::fsm::FiniteStateMachine& fsm) throw (toolbox::fsm::exception::Exception);
51  virtual void statePaused (toolbox::fsm::FiniteStateMachine& fsm) throw (toolbox::fsm::exception::Exception);
52  virtual void stateRunning (toolbox::fsm::FiniteStateMachine& fsm) throw (toolbox::fsm::exception::Exception);
53  virtual void stateHalted (toolbox::fsm::FiniteStateMachine& fsm) throw (toolbox::fsm::exception::Exception);
54  virtual void stateConfigured (toolbox::fsm::FiniteStateMachine& fsm) throw (toolbox::fsm::exception::Exception);
55  virtual void inError (toolbox::fsm::FiniteStateMachine& fsm) throw (toolbox::fsm::exception::Exception);
56 
57  virtual void transitionConfiguring (toolbox::Event::Reference e) throw (toolbox::fsm::exception::Exception);
58  virtual void transitionHalting (toolbox::Event::Reference e) throw (toolbox::fsm::exception::Exception);
59  virtual void transitionInitializing(toolbox::Event::Reference e) throw (toolbox::fsm::exception::Exception);
60  virtual void transitionPausing (toolbox::Event::Reference e) throw (toolbox::fsm::exception::Exception);
61  virtual void transitionResuming (toolbox::Event::Reference e) throw (toolbox::fsm::exception::Exception);
62  virtual void transitionStarting (toolbox::Event::Reference e) throw (toolbox::fsm::exception::Exception);
63  virtual void transitionStopping (toolbox::Event::Reference e) throw (toolbox::fsm::exception::Exception);
64  virtual void enteringError (toolbox::Event::Reference e) throw (toolbox::fsm::exception::Exception);
65 
66 protected:
67  WorkLoopManager stateMachineWorkLoopManager_;
68  toolbox::BSem stateMachineSemaphore_;
69 
70  ConfigurationManager* theConfigurationManager_;
71 
72  std::string XDAQContextConfigurationName_;
73  std::string supervisorConfigurationPath_;
74 
75  std::string supervisorContextUID_;
76  std::string supervisorApplicationUID_;
77  std::string supervisorClass_;
78  std::string supervisorClassNoNamespace_;
79 
80  SupervisorDescriptorInfo supervisorDescriptorInfo_;
81  std::vector<VStateMachine*> theStateMachineImplementation_;
82 };
83 
84 }
85 
86 #endif