00001 #ifndef _ots_EventBuilderApp_h_
00002 #define _ots_EventBuilderApp_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 EventBuilderInterface;
00030
00031 class EventBuilderApp: public xdaq::Application, public SOAPMessenger, public RunControlStateMachine
00032 {
00033
00034 public:
00035
00036 XDAQ_INSTANTIATOR();
00037
00038 EventBuilderApp (xdaq::ApplicationStub * s) throw (xdaq::exception::Exception);
00039 virtual ~EventBuilderApp (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 xoap::MessageReference stateMachineErrorMessageRequest (xoap::MessageReference message ) throw (xoap::exception::Exception);
00054
00055 void stateInitial (toolbox::fsm::FiniteStateMachine& fsm) throw (toolbox::fsm::exception::Exception);
00056 void statePaused (toolbox::fsm::FiniteStateMachine& fsm) throw (toolbox::fsm::exception::Exception);
00057 void stateRunning (toolbox::fsm::FiniteStateMachine& fsm) throw (toolbox::fsm::exception::Exception);
00058 void stateHalted (toolbox::fsm::FiniteStateMachine& fsm) throw (toolbox::fsm::exception::Exception);
00059 void stateConfigured (toolbox::fsm::FiniteStateMachine& fsm) throw (toolbox::fsm::exception::Exception);
00060 void inError (toolbox::fsm::FiniteStateMachine& fsm) throw (toolbox::fsm::exception::Exception);
00061
00062 void transitionConfiguring (toolbox::Event::Reference e) throw (toolbox::fsm::exception::Exception);
00063 void transitionHalting (toolbox::Event::Reference e) throw (toolbox::fsm::exception::Exception);
00064 void transitionInitializing(toolbox::Event::Reference e) throw (toolbox::fsm::exception::Exception);
00065 void transitionPausing (toolbox::Event::Reference e) throw (toolbox::fsm::exception::Exception);
00066 void transitionResuming (toolbox::Event::Reference e) throw (toolbox::fsm::exception::Exception);
00067 void transitionStarting (toolbox::Event::Reference e) throw (toolbox::fsm::exception::Exception);
00068 void transitionStopping (toolbox::Event::Reference e) throw (toolbox::fsm::exception::Exception);
00069 void enteringError (toolbox::Event::Reference e) throw (toolbox::fsm::exception::Exception);
00070
00071 private:
00072 WorkLoopManager stateMachineWorkLoopManager_;
00073 toolbox::BSem stateMachineSemaphore_;
00074
00075 SupervisorDescriptorInfo theSupervisorDescriptorInfo_;
00076 ConfigurationManager* theConfigurationManager_;
00077 std::string XDAQContextConfigurationName_;
00078 std::string supervisorConfigurationPath_;
00079 std::string supervisorContextUID_;
00080 std::string supervisorApplicationUID_;
00081
00082 std::map<int, ots::EventBuilderInterface*> theARTDAQEventBuilderInterfaces_;
00083 std::unique_ptr<artdaq::MPISentry> mpiSentry_;
00084
00085
00086
00087
00088 };
00089
00090 }
00091
00092 #endif