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