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