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