otsdaq_utilities  v2_02_00
MacroMakerSupervisor.h
1 #ifndef _ots_MacroMakerSupervisor_h_
2 #define _ots_MacroMakerSupervisor_h_
3 
4 #include "otsdaq-core/CoreSupervisors/CoreSupervisorBase.h"
5 
6 namespace ots
7 {
8 
9 //MacroMakerSupervisor
10 // This class handles the user interface to the web desktop MacroMaker. MacroMaker
11 // is a tool to conduct read and write commands with front-end interfaces and to manage
12 // sequence of commands on a per user basis.
13 class MacroMakerSupervisor: public CoreSupervisorBase
14 {
15 
16 public:
17 
18  XDAQ_INSTANTIATOR();
19 
20 
21  MacroMakerSupervisor (xdaq::ApplicationStub* s);
22  virtual ~MacroMakerSupervisor (void);
23 
24  void init (void);
25  void destroy (void);
26 
27  virtual void request (const std::string& requestType, cgicc::Cgicc& cgiIn, HttpXmlDocument& xmlOut, const WebUsers::RequestUserInfo& userInfo) override;
28 
29  virtual void forceSupervisorPropertyValues (void) override; //override to force supervisor property values (and ignore user settings)
30 
31 
32 private:
33 
34  void handleRequest (const std::string Command, HttpXmlDocument& xmldoc, cgicc::Cgicc& cgi, const std::string &username);
35 
36  xoap::MessageReference frontEndCommunicationRequest (xoap::MessageReference message);
37 
38  void getFElist (HttpXmlDocument& xmldoc);
39  void getFEMacroList (HttpXmlDocument& xmldoc, const std::string &username);
40 
41  void writeData (HttpXmlDocument& xmldoc, cgicc::Cgicc& cgi, const std::string &username);
42  void readData (HttpXmlDocument& xmldoc, cgicc::Cgicc& cgi, const std::string &username);
43  void createMacro (HttpXmlDocument& xmldoc, cgicc::Cgicc& cgi, const std::string &username);
44  void loadMacro (const std::string& macroName, std::string& macroString, const std::string& username = "");
45  void loadMacros (HttpXmlDocument& xmldoc, const std::string &username);
46  void appendCommandToHistory (std::string command, std::string Format, std::string time, std::string interfaces, const std::string &username);
47  void loadHistory (HttpXmlDocument& xmldoc, const std::string &username);
48  void deleteMacro (HttpXmlDocument& xmldoc,cgicc::Cgicc& cgi, const std::string &username);
49  void editMacro (HttpXmlDocument& xmldoc, cgicc::Cgicc& cgi, const std::string &username);
50  void clearHistory (const std::string &username);
51  void exportMacro (HttpXmlDocument& xmldoc, cgicc::Cgicc& cgi, const std::string &username);
52  void exportFEMacro (HttpXmlDocument& xmldoc, cgicc::Cgicc& cgi, const std::string &username);
53  void runFEMacro (HttpXmlDocument& xmldoc, cgicc::Cgicc& cgi);
54 
55 
56 
57  std::string generateHexArray (const std::string& sourceHexString,int &numOfBytes);
58  bool isArgumentVariable (const std::string& argumentString);
59  void createCode (std::ostream& out, const std::vector<std::string>& commands, const std::string& tabOffset = "", bool forFeMacro = false, std::set<std::string>* inArgNames = 0, std::set<std::string>* outArgNames = 0);
60 
61  SupervisorInfoMap allFESupervisorInfo_;
62  std::map<std::string /*FE UID*/, unsigned int /*superivisor index*/> FEtoSupervisorMap_;
63 
64 }; //end MacroMakerSupervisor declaration
65 
66 } //end ots namespace
67 
68 #endif