1 #ifndef _ots_CoreSupervisorBase_h_
2 #define _ots_CoreSupervisorBase_h_
4 #include "otsdaq/FiniteStateMachine/RunControlStateMachine.h"
5 #include "otsdaq/SOAPUtilities/SOAPMessenger.h"
6 #include "otsdaq/WorkLoopManager/WorkLoopManager.h"
8 #include "otsdaq/CoreSupervisors/CorePropertySupervisorBase.h"
10 #include "otsdaq/CgiDataUtilities/CgiDataUtilities.h"
11 #include "otsdaq/SOAPUtilities/SOAPUtilities.h"
12 #include "otsdaq/XmlUtilities/HttpXmlDocument.h"
14 #include "otsdaq/FiniteStateMachine/VStateMachine.h"
16 #include "otsdaq/MessageFacility/ITRACEController.h"
17 #include "otsdaq/WebUsersUtilities/RemoteWebUsers.h"
19 #pragma GCC diagnostic push
20 #pragma GCC diagnostic ignored "-Wdeprecated-declarations"
21 #include <xdaq/Application.h>
22 #pragma GCC diagnostic pop
23 #include "otsdaq/Macros/XDAQApplicationMacros.h"
24 #include "xgi/Method.h"
26 #include <toolbox/fsm/FailedEvent.h>
28 #include <xdaq/NamespaceURI.h>
29 #include <xoap/Method.h>
50 friend class MacroMakerSupervisor;
59 unsigned int getSupervisorLID (
void)
const {
return getApplicationDescriptor()->getLocalId(); }
68 virtual void defaultPage (xgi::Input* in, xgi::Output* out);
69 virtual void request (
const std::string& requestType,
73 virtual void nonXmlRequest (
const std::string& requestType,
77 virtual std::string getStatusProgressDetail (
void);
80 xoap::MessageReference workLoopStatusRequestWrapper (xoap::MessageReference message);
81 void defaultPageWrapper (xgi::Input* in, xgi::Output* out);
82 void requestWrapper (xgi::Input* in, xgi::Output* out);
86 void stateMachineXgiHandler (xgi::Input* in, xgi::Output* out);
87 xoap::MessageReference stateMachineXoapHandler (xoap::MessageReference message);
89 xoap::MessageReference stateMachineStateRequest (xoap::MessageReference message);
90 xoap::MessageReference stateMachineErrorMessageRequest (xoap::MessageReference message);
92 void sendAsyncErrorToGateway (
const std::string& errMsg,
bool isSoftError);
94 virtual xoap::MessageReference workLoopStatusRequest (xoap::MessageReference message);
95 virtual xoap::MessageReference applicationStatusRequest (xoap::MessageReference message);
97 bool stateMachineThread (toolbox::task::WorkLoop* workLoop);
99 virtual void stateInitial (toolbox::fsm::FiniteStateMachine& fsm);
100 virtual void statePaused (toolbox::fsm::FiniteStateMachine& fsm);
101 virtual void stateRunning (toolbox::fsm::FiniteStateMachine& fsm);
102 virtual void stateHalted (toolbox::fsm::FiniteStateMachine& fsm);
103 virtual void stateConfigured (toolbox::fsm::FiniteStateMachine& fsm);
104 virtual void inError (toolbox::fsm::FiniteStateMachine& fsm);
106 virtual void transitionConfiguring (toolbox::Event::Reference event);
108 void transitionConfiguringFSMs(
void);
110 virtual void transitionHalting (toolbox::Event::Reference event);
111 virtual void transitionInitializing (toolbox::Event::Reference event);
112 virtual void transitionPausing (toolbox::Event::Reference event);
113 virtual void transitionResuming (toolbox::Event::Reference event);
114 virtual void transitionStarting (toolbox::Event::Reference event);
115 virtual void transitionStopping (toolbox::Event::Reference event);
116 virtual void enteringError (toolbox::Event::Reference event);
118 static const std::string WORK_LOOP_DONE, WORK_LOOP_WORKING;
124 toolbox::BSem stateMachineSemaphore_;
125 std::vector<VStateMachine*> theStateMachineImplementation_;
128 std::vector<bool> stateMachinesIterationDone_;
129 unsigned int stateMachinesIterationWorkCount_;
130 unsigned int subIterationWorkStateMachineIndex_;
131 void preStateMachineExecution(
unsigned int i);
132 void postStateMachineExecution(
unsigned int i);
133 void preStateMachineExecutionLoop(
void);
134 void postStateMachineExecutionLoop(
void);