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