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