otsdaq  v2_05_02_indev
XDAQContextTable.h
1 #ifndef _ots_XDAQContextTable_h_
2 #define _ots_XDAQContextTable_h_
3 
4 #include <string>
5 
6 #include "otsdaq/ConfigurationInterface/ConfigurationManager.h"
7 #include "otsdaq/TableCore/TableBase.h"
8 
9 namespace ots
10 {
11 // clang-format off
13 {
14  public:
15 
17  {
18  bool status_;
19  std::string name_, type_, value_;
20  };
21 
23  {
24  static const uint8_t DEFAULT_PRIORITY;
25 
26  std::string applicationGroupID_;
27  std::string applicationUID_;
28  bool status_;
29  std::string class_;
30  unsigned int id_;
31  unsigned int instance_;
32  std::string network_;
33  std::string group_;
34  std::string module_;
35  std::string sourceConfig_;
36  std::map<std::string /*FSM command*/, uint8_t /*priority*/>
37  stateMachineCommandPriority_;
38 
39  std::vector<XDAQApplicationProperty> properties_;
40  };
41 
42  struct XDAQContext
43  {
44  std::string contextUID_;
45  std::string sourceConfig_;
46  bool status_;
47  unsigned int id_;
48  std::string address_;
49  unsigned int port_;
50  std::vector<XDAQApplication> applications_;
51  };
52 
53  XDAQContextTable (void);
54  virtual ~XDAQContextTable (void);
55 
56  // Methods
57  void init (ConfigurationManager* configManager);
58  void extractContexts (ConfigurationManager* configManager);
59  void outputXDAQXML (std::ostream& out);
60  // void outputAppPriority (std::ostream &out,
61  // const std::string& stateMachineCommand); void outputXDAQScript (std::ostream
62  // &out); void outputARTDAQScript (std::ostream &out);
63 
64  std::string getContextUID (const std::string& url) const;
65  std::string getApplicationUID (const std::string& url, unsigned int id) const;
66  std::string getContextOfApplication (ConfigurationManager* configManager, const std::string& appUID) const;
67  std::string getContextOfGateway (ConfigurationManager* configManager) const;
68 
69  const std::vector<XDAQContext>& getContexts (void) const { return contexts_; }
70 
71  static ConfigurationTree getContextNode (const ConfigurationManager* configManager, const std::string& contextUID);
72  static ConfigurationTree getApplicationNode (const ConfigurationManager* configManager, const std::string& contextUID, const std::string& appUID);
73  static ConfigurationTree getSupervisorConfigNode (const ConfigurationManager* configManager, const std::string& contextUID, const std::string& appUID);
74  std::string getContextAddress (const std::string& contextUID = "X", bool wantHttp = false) const;
75 
76  // artdaq specific get methods
77  const XDAQContext* getTheARTDAQSupervisorContext (void) const;
78 
79  private:
80  std::vector<XDAQContext> contexts_;
81  unsigned int /*contextIndex*/ artdaqSupervisorContext_;
82 
83  public:
84  // XDAQ Context Column names
85  static struct ColContext
86  {
87  std::string const colContextUID_ = "ContextUID";
88  std::string const colLinkToApplicationTable_ = "LinkToApplicationTable";
89  std::string const colLinkToApplicationGroupID_ = "LinkToApplicationGroupID";
90  std::string const colStatus_ = TableViewColumnInfo::COL_NAME_STATUS;
91  std::string const colId_ = "Id";
92  std::string const colAddress_ = "Address";
93  std::string const colPort_ = "Port";
94  } colContext_;
95 
96  // XDAQ App Column names
97  static struct ColApplication
98  {
99  std::string const colApplicationGroupID_ = "ApplicationGroupID";
100  std::string const colApplicationUID_ = "ApplicationUID";
101  std::string const colLinkToSupervisorTable_ = "LinkToSupervisorTable";
102  std::string const colLinkToSupervisorUID_ = "LinkToSupervisorUID";
103  std::string const colStatus_ = TableViewColumnInfo::COL_NAME_STATUS;
104  std::string const colClass_ = "Class";
105  std::string const colId_ = "Id";
106  std::string const colInstance_ = "Instance";
107  std::string const colNetwork_ = "Network";
108  std::string const colGroup_ = "Group";
109  std::string const colModule_ = "Module";
110  std::string const colConfigurePriority_ = "ConfigurePriority";
111  std::string const colStartPriority_ = "StartPriority";
112  std::string const colStopPriority_ = "StopPriority";
113  std::string const colLinkToPropertyTable_ = "LinkToPropertyTable";
114  std::string const colLinkToPropertyGroupID_ = "LinkToPropertyGroupID";
115 
116  } colApplication_;
117 
118  // XDAQ App Property Column names
120  {
121  std::string const colPropertyGroupID_ = "PropertyGroupID";
122  std::string const colPropertyUID_ = "UID";
123  std::string const colStatus_ = TableViewColumnInfo::COL_NAME_STATUS;
124  std::string const colPropertyName_ = "PropertyName";
125  std::string const colPropertyType_ = "PropertyType";
126  std::string const colPropertyValue_ = "PropertyValue";
127 
128  } colAppProperty_;
129 
130 
131  public:
132  static const std::set<std::string> FETypeClassNames_, DMTypeClassNames_,
133  LogbookTypeClassNames_, MacroMakerTypeClassNames_, ChatTypeClassNames_,
134  ConsoleTypeClassNames_, ConfigurationGUITypeClassNames_;
135  static const std::string GATEWAY_SUPERVISOR_CLASS, WIZARD_SUPERVISOR_CLASS,
136  DEPRECATED_SUPERVISOR_CLASS;
137 }; //end XDAQContextTable class
138 } // namespace ots
139 // clang-format on
140 #endif
void outputXDAQXML(std::ostream &out)