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