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