otsdaq  v2_01_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 "otsdaq-core/Macros/XDAQApplicationMacros.h"
17 #include <xgi/Method.h>
18 
19 #include <string>
20 #include <map>
21 
22 #include <memory>
23 
24 namespace ots
25 {
26 
27 class ConfigurationManager;
28 class ConfigurationGroupKey;
29 
30 //DispatcherApp
31 // This class provides the otsdaq interface to a single artdaq Dispatcher.
32 class DispatcherApp: public xdaq::Application, public SOAPMessenger, public RunControlStateMachine
33 {
34 
35 public:
36 
37  XDAQ_INSTANTIATOR();
38 
39  DispatcherApp (xdaq::ApplicationStub * s) ;
40  virtual ~DispatcherApp (void);
41  void init (void);
42  void destroy (void);
43  void Default (xgi::Input* in, xgi::Output* out) ;
44 
45 
46  //State Machine requests handlers
47  void stateMachineXgiHandler (xgi::Input* in, xgi::Output* out ) ;
48  void stateMachineResultXgiHandler (xgi::Input* in, xgi::Output* out ) ;
49  xoap::MessageReference stateMachineXoapHandler (xoap::MessageReference message ) ;
50  xoap::MessageReference stateMachineResultXoapHandler (xoap::MessageReference message ) ;
51  bool stateMachineThread (toolbox::task::WorkLoop* workLoop);
52 
53  xoap::MessageReference stateMachineStateRequest (xoap::MessageReference message ) ;
54  xoap::MessageReference stateMachineErrorMessageRequest (xoap::MessageReference message ) ;
55 
56  void stateInitial (toolbox::fsm::FiniteStateMachine& fsm) ;
57  void statePaused (toolbox::fsm::FiniteStateMachine& fsm) ;
58  void stateRunning (toolbox::fsm::FiniteStateMachine& fsm) ;
59  void stateHalted (toolbox::fsm::FiniteStateMachine& fsm) ;
60  void stateConfigured (toolbox::fsm::FiniteStateMachine& fsm) ;
61  void inError (toolbox::fsm::FiniteStateMachine& fsm) ;
62 
63  void transitionConfiguring (toolbox::Event::Reference e) ;
64  void transitionHalting (toolbox::Event::Reference e) ;
65  void transitionInitializing(toolbox::Event::Reference e) ;
66  void transitionPausing (toolbox::Event::Reference e) ;
67  void transitionResuming (toolbox::Event::Reference e) ;
68  void transitionStarting (toolbox::Event::Reference e) ;
69  void transitionStopping (toolbox::Event::Reference e) ;
70  void enteringError (toolbox::Event::Reference e) ;
71 
72 private:
73  WorkLoopManager stateMachineWorkLoopManager_;
74  toolbox::BSem stateMachineSemaphore_;
75 
76  AllSupervisorInfo allSupervisorInfo_;
77  ConfigurationManager* theConfigurationManager_;
78  std::string XDAQContextConfigurationName_;
79  std::string supervisorConfigurationPath_;
80  std::string supervisorContextUID_;
81  std::string supervisorApplicationUID_;
82 
83  artdaq::DispatcherApp* theDispatcherInterface_;
84 
85 };
86 
87 }
88 
89 #endif