otsdaq  v1_01_02
 All Classes Namespaces Functions
AggregatorApp.h
1 #ifndef _ots_ARTDAQAggregatorSupervisor_h
2 #define _ots_ARTDAQAggregatorSupervisor_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 AggregatorInterface;
30 
31 class AggregatorApp: public xdaq::Application, public SOAPMessenger, public RunControlStateMachine
32 {
33 
34 public:
35 
36  XDAQ_INSTANTIATOR();
37 
38  AggregatorApp (xdaq::ApplicationStub * s) throw (xdaq::exception::Exception);
39  virtual ~AggregatorApp (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 
54  void stateInitial (toolbox::fsm::FiniteStateMachine& fsm) throw (toolbox::fsm::exception::Exception);
55  void statePaused (toolbox::fsm::FiniteStateMachine& fsm) throw (toolbox::fsm::exception::Exception);
56  void stateRunning (toolbox::fsm::FiniteStateMachine& fsm) throw (toolbox::fsm::exception::Exception);
57  void stateHalted (toolbox::fsm::FiniteStateMachine& fsm) throw (toolbox::fsm::exception::Exception);
58  void stateConfigured (toolbox::fsm::FiniteStateMachine& fsm) throw (toolbox::fsm::exception::Exception);
59  void inError (toolbox::fsm::FiniteStateMachine& fsm) throw (toolbox::fsm::exception::Exception);
60 
61  void transitionConfiguring (toolbox::Event::Reference e) throw (toolbox::fsm::exception::Exception);
62  void transitionHalting (toolbox::Event::Reference e) throw (toolbox::fsm::exception::Exception);
63  void transitionInitializing(toolbox::Event::Reference e) throw (toolbox::fsm::exception::Exception);
64  void transitionPausing (toolbox::Event::Reference e) throw (toolbox::fsm::exception::Exception);
65  void transitionResuming (toolbox::Event::Reference e) throw (toolbox::fsm::exception::Exception);
66  void transitionStarting (toolbox::Event::Reference e) throw (toolbox::fsm::exception::Exception);
67  void transitionStopping (toolbox::Event::Reference e) throw (toolbox::fsm::exception::Exception);
68  void enteringError (toolbox::Event::Reference e) throw (toolbox::fsm::exception::Exception);
69 
70 private:
71  WorkLoopManager stateMachineWorkLoopManager_;
72  toolbox::BSem stateMachineSemaphore_;
73 
74  SupervisorDescriptorInfo theSupervisorDescriptorInfo_;
75  ConfigurationManager* theConfigurationManager_;
76  std::string XDAQContextConfigurationName_;
77  std::string supervisorConfigurationPath_;
78  std::string supervisorContextUID_;
79  std::string supervisorApplicationUID_;
80 
81  ots::AggregatorInterface* theAggregatorInterface_;
82  std::unique_ptr<artdaq::MPISentry> mpiSentry_;
83 
84 };
85 
86 }
87 
88 #endif