00001 #ifndef _ots_ARTDAQAggregatorSupervisor_h
00002 #define _ots_ARTDAQAggregatorSupervisor_h
00003
00004 #include "otsdaq-core/WorkLoopManager/WorkLoopManager.h"
00005 #include "otsdaq-core/FiniteStateMachine/RunControlStateMachine.h"
00006 #include "otsdaq-core/Supervisor/SupervisorsInfo.h"
00007 #include "otsdaq-core/SOAPUtilities/SOAPMessenger.h"
00008 #include "otsdaq-core/SupervisorDescriptorInfo/SupervisorDescriptorInfo.h"
00009
00010 #pragma GCC diagnostic push
00011 #pragma GCC diagnostic ignored "-Wdeprecated-declarations"
00012 #include <xdaq/Application.h>
00013 #pragma GCC diagnostic pop
00014 #include <xgi/Method.h>
00015
00016 #include <string>
00017 #include <map>
00018
00019 #include <memory>
00020
00021 #include "artdaq/Application/MPI2/MPISentry.hh"
00022
00023
00024 namespace ots
00025 {
00026
00027 class ConfigurationManager;
00028 class ConfigurationGroupKey;
00029 class AggregatorInterface;
00030
00031 class AggregatorApp: public xdaq::Application, public SOAPMessenger, public RunControlStateMachine
00032 {
00033
00034 public:
00035
00036 XDAQ_INSTANTIATOR();
00037
00038 AggregatorApp (xdaq::ApplicationStub * s) throw (xdaq::exception::Exception);
00039 virtual ~AggregatorApp (void);
00040 void init (void);
00041 void destroy (void);
00042 void Default (xgi::Input* in, xgi::Output* out) throw (xgi::exception::Exception);
00043
00044
00045
00046 void stateMachineXgiHandler (xgi::Input* in, xgi::Output* out ) throw (xgi::exception::Exception);
00047 void stateMachineResultXgiHandler (xgi::Input* in, xgi::Output* out ) throw (xgi::exception::Exception);
00048 xoap::MessageReference stateMachineXoapHandler (xoap::MessageReference message ) throw (xoap::exception::Exception);
00049 xoap::MessageReference stateMachineResultXoapHandler(xoap::MessageReference message ) throw (xoap::exception::Exception);
00050 bool stateMachineThread (toolbox::task::WorkLoop* workLoop);
00051
00052 xoap::MessageReference stateMachineStateRequest (xoap::MessageReference message ) throw (xoap::exception::Exception);
00053
00054 void stateInitial (toolbox::fsm::FiniteStateMachine& fsm) throw (toolbox::fsm::exception::Exception);
00055 void statePaused (toolbox::fsm::FiniteStateMachine& fsm) throw (toolbox::fsm::exception::Exception);
00056 void stateRunning (toolbox::fsm::FiniteStateMachine& fsm) throw (toolbox::fsm::exception::Exception);
00057 void stateHalted (toolbox::fsm::FiniteStateMachine& fsm) throw (toolbox::fsm::exception::Exception);
00058 void stateConfigured (toolbox::fsm::FiniteStateMachine& fsm) throw (toolbox::fsm::exception::Exception);
00059 void inError (toolbox::fsm::FiniteStateMachine& fsm) throw (toolbox::fsm::exception::Exception);
00060
00061 void transitionConfiguring (toolbox::Event::Reference e) throw (toolbox::fsm::exception::Exception);
00062 void transitionHalting (toolbox::Event::Reference e) throw (toolbox::fsm::exception::Exception);
00063 void transitionInitializing(toolbox::Event::Reference e) throw (toolbox::fsm::exception::Exception);
00064 void transitionPausing (toolbox::Event::Reference e) throw (toolbox::fsm::exception::Exception);
00065 void transitionResuming (toolbox::Event::Reference e) throw (toolbox::fsm::exception::Exception);
00066 void transitionStarting (toolbox::Event::Reference e) throw (toolbox::fsm::exception::Exception);
00067 void transitionStopping (toolbox::Event::Reference e) throw (toolbox::fsm::exception::Exception);
00068 void enteringError (toolbox::Event::Reference e) throw (toolbox::fsm::exception::Exception);
00069
00070 private:
00071 WorkLoopManager stateMachineWorkLoopManager_;
00072 toolbox::BSem stateMachineSemaphore_;
00073
00074 SupervisorDescriptorInfo theSupervisorDescriptorInfo_;
00075 ConfigurationManager* theConfigurationManager_;
00076 std::string XDAQContextConfigurationName_;
00077 std::string supervisorConfigurationPath_;
00078 std::string supervisorContextUID_;
00079 std::string supervisorApplicationUID_;
00080
00081 ots::AggregatorInterface* theAggregatorInterface_;
00082 std::unique_ptr<artdaq::MPISentry> mpiSentry_;
00083
00084 };
00085
00086 }
00087
00088 #endif