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