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