00001 #ifndef _ots_ARTDAQDispatcherSupervisor_h
00002 #define _ots_ARTDAQDispatcherSupervisor_h
00003
00004 #include "otsdaq-core/WorkLoopManager/WorkLoopManager.h"
00005 #include "otsdaq-core/FiniteStateMachine/RunControlStateMachine.h"
00006 #include "otsdaq-core/SOAPUtilities/SOAPMessenger.h"
00007
00008 #include "otsdaq-core/SupervisorInfo/AllSupervisorInfo.h"
00009
00010 #include "artdaq/Application/DispatcherApp.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
00030
00031
00032 class DispatcherApp: public xdaq::Application, public SOAPMessenger, public RunControlStateMachine
00033 {
00034
00035 public:
00036
00037 XDAQ_INSTANTIATOR();
00038
00039 DispatcherApp (xdaq::ApplicationStub * s) ;
00040 virtual ~DispatcherApp (void);
00041 void init (void);
00042 void destroy (void);
00043 void Default (xgi::Input* in, xgi::Output* out) ;
00044
00045
00046
00047 void stateMachineXgiHandler (xgi::Input* in, xgi::Output* out ) ;
00048 void stateMachineResultXgiHandler (xgi::Input* in, xgi::Output* out ) ;
00049 xoap::MessageReference stateMachineXoapHandler (xoap::MessageReference message ) ;
00050 xoap::MessageReference stateMachineResultXoapHandler (xoap::MessageReference message ) ;
00051 bool stateMachineThread (toolbox::task::WorkLoop* workLoop);
00052
00053 xoap::MessageReference stateMachineStateRequest (xoap::MessageReference message ) ;
00054 xoap::MessageReference stateMachineErrorMessageRequest (xoap::MessageReference message ) ;
00055
00056 void stateInitial (toolbox::fsm::FiniteStateMachine& fsm) ;
00057 void statePaused (toolbox::fsm::FiniteStateMachine& fsm) ;
00058 void stateRunning (toolbox::fsm::FiniteStateMachine& fsm) ;
00059 void stateHalted (toolbox::fsm::FiniteStateMachine& fsm) ;
00060 void stateConfigured (toolbox::fsm::FiniteStateMachine& fsm) ;
00061 void inError (toolbox::fsm::FiniteStateMachine& fsm) ;
00062
00063 void transitionConfiguring (toolbox::Event::Reference e) ;
00064 void transitionHalting (toolbox::Event::Reference e) ;
00065 void transitionInitializing(toolbox::Event::Reference e) ;
00066 void transitionPausing (toolbox::Event::Reference e) ;
00067 void transitionResuming (toolbox::Event::Reference e) ;
00068 void transitionStarting (toolbox::Event::Reference e) ;
00069 void transitionStopping (toolbox::Event::Reference e) ;
00070 void enteringError (toolbox::Event::Reference e) ;
00071
00072 private:
00073 WorkLoopManager stateMachineWorkLoopManager_;
00074 toolbox::BSem stateMachineSemaphore_;
00075
00076 AllSupervisorInfo allSupervisorInfo_;
00077 ConfigurationManager* theConfigurationManager_;
00078 std::string XDAQContextConfigurationName_;
00079 std::string supervisorConfigurationPath_;
00080 std::string supervisorContextUID_;
00081 std::string supervisorApplicationUID_;
00082
00083 artdaq::DispatcherApp* theDispatcherInterface_;
00084
00085 };
00086
00087 }
00088
00089 #endif