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 <xgi/Method.h>
00017
00018 #include <string>
00019 #include <map>
00020
00021 #include <memory>
00022
00023 namespace ots
00024 {
00025
00026 class ConfigurationManager;
00027 class ConfigurationGroupKey;
00028
00032 class EventBuilderApp: public xdaq::Application, public SOAPMessenger, public RunControlStateMachine
00033 {
00034
00035 public:
00036
00037 XDAQ_INSTANTIATOR();
00038
00039 EventBuilderApp (xdaq::ApplicationStub * s) throw (xdaq::exception::Exception);
00040 virtual ~EventBuilderApp (void);
00041 void init (void);
00042 void destroy (void);
00043 void Default (xgi::Input* in, xgi::Output* out) throw (xgi::exception::Exception);
00044
00045
00046
00047 void stateMachineXgiHandler (xgi::Input* in, xgi::Output* out ) throw (xgi::exception::Exception);
00048 void stateMachineResultXgiHandler (xgi::Input* in, xgi::Output* out ) throw (xgi::exception::Exception);
00049 xoap::MessageReference stateMachineXoapHandler (xoap::MessageReference message ) throw (xoap::exception::Exception);
00050 xoap::MessageReference stateMachineResultXoapHandler (xoap::MessageReference message ) throw (xoap::exception::Exception);
00051 bool stateMachineThread (toolbox::task::WorkLoop* workLoop);
00052
00053 xoap::MessageReference stateMachineStateRequest (xoap::MessageReference message ) throw (xoap::exception::Exception);
00054 xoap::MessageReference stateMachineErrorMessageRequest (xoap::MessageReference message ) throw (xoap::exception::Exception);
00055
00056 void stateInitial (toolbox::fsm::FiniteStateMachine& fsm) throw (toolbox::fsm::exception::Exception);
00057 void statePaused (toolbox::fsm::FiniteStateMachine& fsm) throw (toolbox::fsm::exception::Exception);
00058 void stateRunning (toolbox::fsm::FiniteStateMachine& fsm) throw (toolbox::fsm::exception::Exception);
00059 void stateHalted (toolbox::fsm::FiniteStateMachine& fsm) throw (toolbox::fsm::exception::Exception);
00060 void stateConfigured (toolbox::fsm::FiniteStateMachine& fsm) throw (toolbox::fsm::exception::Exception);
00061 void inError (toolbox::fsm::FiniteStateMachine& fsm) throw (toolbox::fsm::exception::Exception);
00062
00063 void transitionConfiguring (toolbox::Event::Reference e) throw (toolbox::fsm::exception::Exception);
00064 void transitionHalting (toolbox::Event::Reference e) throw (toolbox::fsm::exception::Exception);
00065 void transitionInitializing(toolbox::Event::Reference e) throw (toolbox::fsm::exception::Exception);
00066 void transitionPausing (toolbox::Event::Reference e) throw (toolbox::fsm::exception::Exception);
00067 void transitionResuming (toolbox::Event::Reference e) throw (toolbox::fsm::exception::Exception);
00068 void transitionStarting (toolbox::Event::Reference e) throw (toolbox::fsm::exception::Exception);
00069 void transitionStopping (toolbox::Event::Reference e) throw (toolbox::fsm::exception::Exception);
00070 void enteringError (toolbox::Event::Reference e) throw (toolbox::fsm::exception::Exception);
00071
00072 private:
00073
00074 WorkLoopManager stateMachineWorkLoopManager_;
00075 toolbox::BSem stateMachineSemaphore_;
00076
00077 AllSupervisorInfo allSupervisorInfo_;
00078 ConfigurationManager* theConfigurationManager_;
00079 std::string XDAQContextConfigurationName_;
00080 std::string supervisorConfigurationPath_;
00081 std::string supervisorContextUID_;
00082 std::string supervisorApplicationUID_;
00083
00084
00085 std::map<int, artdaq::EventBuilderApp*> theARTDAQEventBuilderInterfaces_;
00086
00087 };
00088
00089 }
00090
00091 #endif