otsdaq_utilities  v2_03_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 // 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  void handleRequest(const std::string Command,
35  HttpXmlDocument& xmldoc,
36  cgicc::Cgicc& cgi,
37  const std::string& username);
38 
39  xoap::MessageReference frontEndCommunicationRequest(xoap::MessageReference message);
40 
41  void getFElist(HttpXmlDocument& xmldoc);
42  void getFEMacroList(HttpXmlDocument& xmldoc, const std::string& username);
43 
44  void writeData(HttpXmlDocument& xmldoc,
45  cgicc::Cgicc& cgi,
46  const std::string& username);
47  void readData(HttpXmlDocument& xmldoc,
48  cgicc::Cgicc& cgi,
49  const std::string& username);
50  void createMacro(HttpXmlDocument& xmldoc,
51  cgicc::Cgicc& cgi,
52  const std::string& username);
53  void loadMacro(const std::string& macroName,
54  std::string& macroString,
55  const std::string& username = "");
56  void loadMacros(HttpXmlDocument& xmldoc, const std::string& username);
57  void loadMacroNames(
58  const std::string& username,
59  std::pair<std::vector<std::string> /*public macros*/,
60  std::vector<std::string> /*private macros*/>& returnMacroNames);
61  void appendCommandToHistory(std::string command,
62  std::string Format,
63  std::string time,
64  std::string interfaces,
65  const std::string& username);
66  void loadHistory(HttpXmlDocument& xmldoc, const std::string& username);
67  void deleteMacro(HttpXmlDocument& xmldoc,
68  cgicc::Cgicc& cgi,
69  const std::string& username);
70  void editMacro(HttpXmlDocument& xmldoc,
71  cgicc::Cgicc& cgi,
72  const std::string& username);
73  void clearHistory(const std::string& username);
74  void exportMacro(HttpXmlDocument& xmldoc,
75  cgicc::Cgicc& cgi,
76  const std::string& username);
77  void exportFEMacro(HttpXmlDocument& xmldoc,
78  cgicc::Cgicc& cgi,
79  const std::string& username);
80  void runFEMacro(HttpXmlDocument& xmldoc, cgicc::Cgicc& cgi, const std::string& username);
81 
82  std::string generateHexArray(const std::string& sourceHexString, int& numOfBytes);
83  bool isArgumentVariable(const std::string& argumentString);
84  void createCode(std::ostream& out,
85  const std::vector<std::string>& commands,
86  const std::string& tabOffset = "",
87  bool forFeMacro = false,
88  std::set<std::string>* inArgNames = 0,
89  std::set<std::string>* outArgNames = 0);
90 
91  SupervisorInfoMap allFESupervisorInfo_;
92  std::map<std::string /*FE UID*/, unsigned int /*superivisor index*/>
93  FEtoSupervisorMap_;
94  std::map<std::string /*FE Type*/, std::set<std::string> /*FE UIDs*/>
95  FEPluginTypetoFEsMap_;
96  std::map<std::string /*FE UID*/, std::string /*FE Type*/>
97  FEtoPluginTypeMap_;
98 
99 }; // end MacroMakerSupervisor declaration
100 
101 } // end ots namespace
102 
103 #endif