otsdaq_utilities  v2_05_02_indev
MacroMakerSupervisor.h
1 #ifndef _ots_MacroMakerSupervisor_h_
2 #define _ots_MacroMakerSupervisor_h_
3 
4 #include "otsdaq/CoreSupervisors/CoreSupervisorBase.h"
5 
6 namespace ots
7 {
8 // MacroMakerSupervisor
9 // This class handles the user interface to the web desktop MacroMaker. MacroMaker
10 // is a tool to conduct read and write commands with front-end interfaces and to manage
11 // sequence of commands on a per user basis.
12 class MacroMakerSupervisor : public CoreSupervisorBase
13 {
14  public:
15  XDAQ_INSTANTIATOR();
16 
17  MacroMakerSupervisor(xdaq::ApplicationStub* s);
18  virtual ~MacroMakerSupervisor(void);
19 
20  void init(void);
21  void destroy(void);
22 
23  virtual void request(const std::string& requestType,
24  cgicc::Cgicc& cgiIn,
25  HttpXmlDocument& xmlOut,
26  const WebUsers::RequestUserInfo& userInfo) override;
27 
28  virtual void forceSupervisorPropertyValues(void) override; // override to force
29  // supervisor property
30  // values (and ignore user
31  // settings)
32 
33  private:
34  // start MacroMaker only functions
35  void generateURL(void);
36  void verification(xgi::Input* in, xgi::Output* out);
37  void requestIcons(xgi::Input* in, xgi::Output* out);
38  void tooltipRequest(xgi::Input* in, xgi::Output* out);
39  void requestWrapper(xgi::Input* in, xgi::Output* out);
40  // end MacroMaker only functions
41 
42  void handleRequest(const std::string Command,
43  HttpXmlDocument& xmldoc,
44  cgicc::Cgicc& cgi,
45  const std::string& username);
46 
47  xoap::MessageReference frontEndCommunicationRequest(xoap::MessageReference message);
48 
49  void getFElist(HttpXmlDocument& xmldoc);
50  void getFEMacroList(HttpXmlDocument& xmldoc, const std::string& username);
51 
52  void writeData(HttpXmlDocument& xmldoc,
53  cgicc::Cgicc& cgi,
54  const std::string& username);
55  void readData(HttpXmlDocument& xmldoc,
56  cgicc::Cgicc& cgi,
57  const std::string& username);
58  void createMacro(HttpXmlDocument& xmldoc,
59  cgicc::Cgicc& cgi,
60  const std::string& username);
61  void loadMacro(const std::string& macroName,
62  std::string& macroString,
63  const std::string& username = "");
64  void loadMacros(HttpXmlDocument& xmldoc, const std::string& username);
65  void loadMacroNames(
66  const std::string& username,
67  std::pair<std::vector<std::string> /*public macros*/,
68  std::vector<std::string> /*private macros*/>& returnMacroNames);
69  void appendCommandToHistory(std::string command,
70  std::string Format,
71  std::string time,
72  std::string interfaces,
73  const std::string& username);
74  void loadHistory(HttpXmlDocument& xmldoc, const std::string& username);
75  void deleteMacro(HttpXmlDocument& xmldoc,
76  cgicc::Cgicc& cgi,
77  const std::string& username);
78  void editMacro(HttpXmlDocument& xmldoc,
79  cgicc::Cgicc& cgi,
80  const std::string& username);
81  void clearHistory(const std::string& username);
82  void exportMacro(HttpXmlDocument& xmldoc,
83  cgicc::Cgicc& cgi,
84  const std::string& username);
85  void exportFEMacro(HttpXmlDocument& xmldoc,
86  cgicc::Cgicc& cgi,
87  const std::string& username);
88  void runFEMacro(HttpXmlDocument& xmldoc,
89  cgicc::Cgicc& cgi,
90  const std::string& username);
91 
92  std::string generateHexArray(const std::string& sourceHexString, int& numOfBytes);
93  bool isArgumentVariable(const std::string& argumentString);
94  void createCode(std::ostream& out,
95  const std::vector<std::string>& commands,
96  const std::string& tabOffset = "",
97  bool forFeMacro = false,
98  std::set<std::string>* inArgNames = 0,
99  std::set<std::string>* outArgNames = 0);
100 
101  SupervisorInfoMap allFESupervisorInfo_;
102  std::map<std::string /*FE UID*/, unsigned int /*superivisor index*/>
103  FEtoSupervisorMap_;
104  std::map<std::string /*FE Type*/, std::set<std::string> /*FE UIDs*/>
105  FEPluginTypetoFEsMap_;
106  std::map<std::string /*FE UID*/, std::string /*FE Type*/> FEtoPluginTypeMap_;
107 
108  std::string securityCode_;
109  bool defaultSequence_;
110 
111 }; // end MacroMakerSupervisor declaration
112 
113 } // end ots namespace
114 
115 #endif