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