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 stateMachineErrorMessageRequest (xoap::MessageReference message ) throw (xoap::exception::Exception);
00047 xoap::MessageReference macroMakerSupervisorRequest (xoap::MessageReference message ) throw (xoap::exception::Exception);
00048 xoap::MessageReference workLoopStatusRequest (xoap::MessageReference message ) throw (xoap::exception::Exception);
00049
00050 bool stateMachineThread (toolbox::task::WorkLoop* workLoop);
00051
00052 virtual void stateInitial (toolbox::fsm::FiniteStateMachine& fsm) throw (toolbox::fsm::exception::Exception);
00053 virtual void statePaused (toolbox::fsm::FiniteStateMachine& fsm) throw (toolbox::fsm::exception::Exception);
00054 virtual void stateRunning (toolbox::fsm::FiniteStateMachine& fsm) throw (toolbox::fsm::exception::Exception);
00055 virtual void stateHalted (toolbox::fsm::FiniteStateMachine& fsm) throw (toolbox::fsm::exception::Exception);
00056 virtual void stateConfigured (toolbox::fsm::FiniteStateMachine& fsm) throw (toolbox::fsm::exception::Exception);
00057 virtual void inError (toolbox::fsm::FiniteStateMachine& fsm) throw (toolbox::fsm::exception::Exception);
00058
00059 virtual void transitionConfiguring (toolbox::Event::Reference e) throw (toolbox::fsm::exception::Exception);
00060 virtual void transitionHalting (toolbox::Event::Reference e) throw (toolbox::fsm::exception::Exception);
00061 virtual void transitionInitializing(toolbox::Event::Reference e) throw (toolbox::fsm::exception::Exception);
00062 virtual void transitionPausing (toolbox::Event::Reference e) throw (toolbox::fsm::exception::Exception);
00063 virtual void transitionResuming (toolbox::Event::Reference e) throw (toolbox::fsm::exception::Exception);
00064 virtual void transitionStarting (toolbox::Event::Reference e) throw (toolbox::fsm::exception::Exception);
00065 virtual void transitionStopping (toolbox::Event::Reference e) throw (toolbox::fsm::exception::Exception);
00066 virtual void enteringError (toolbox::Event::Reference e) throw (toolbox::fsm::exception::Exception);
00067
00068 protected:
00069
00070
00071 FEVInterfacesManager* extractFEInterfaceManager();
00072
00073
00074 WorkLoopManager stateMachineWorkLoopManager_;
00075 toolbox::BSem stateMachineSemaphore_;
00076
00077 ConfigurationManager* theConfigurationManager_;
00078
00079 std::string XDAQContextConfigurationName_;
00080 std::string supervisorConfigurationPath_;
00081
00082 std::string supervisorContextUID_;
00083 std::string supervisorApplicationUID_;
00084 std::string supervisorClass_;
00085 std::string supervisorClassNoNamespace_;
00086
00087 SupervisorDescriptorInfo supervisorDescriptorInfo_;
00088 std::vector<VStateMachine*> theStateMachineImplementation_;
00089 };
00090
00091 }
00092
00093 #endif