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