tdaq-develop-2025-02-12
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  static const unsigned int GATEWAY_APP_ID;
26 
27  std::string applicationGroupID_;
28  std::string applicationUID_;
29  bool status_;
30  std::string class_;
31  unsigned int id_;
32  unsigned int instance_;
33  std::string network_;
34  std::string group_;
35  std::string module_;
36  std::string sourceConfig_;
37  std::map<std::string /*FSM command*/, uint8_t /*priority*/>
38  stateMachineCommandPriority_;
39 
40  std::vector<XDAQApplicationProperty> properties_;
41  };
42 
43  struct XDAQContext
44  {
45  std::string contextUID_;
46  std::string sourceConfig_;
47  bool status_;
48  unsigned int id_;
49  std::string address_;
50  unsigned int port_;
51  std::vector<XDAQApplication> applications_;
52  };
53 
54  XDAQContextTable (void);
55  virtual ~XDAQContextTable (void);
56 
58  void init (ConfigurationManager* configManager);
59  void extractContexts (ConfigurationManager* configManager);
60  void outputXDAQXML (std::ostream& out);
65  std::string getContextUID (const std::string& url) const;
66  std::string getApplicationUID (const std::string& url, unsigned int id) const;
67  std::string getContextOfApplication (ConfigurationManager* configManager, const std::string& appUID) const;
68  std::string getContextOfGateway (ConfigurationManager* configManager) const;
69 
70  const std::vector<XDAQContext>& getContexts (void) const { return contexts_; }
71 
72  static ConfigurationTree getContextNode (const ConfigurationManager* configManager, const std::string& contextUID);
73  static ConfigurationTree getApplicationNode (const ConfigurationManager* configManager, const std::string& contextUID, const std::string& appUID);
74  static ConfigurationTree getSupervisorConfigNode (const ConfigurationManager* configManager, const std::string& contextUID, const std::string& appUID);
75  std::string getContextAddress (const std::string& contextUID = "X", bool wantHttp = false) const;
76 
78  const XDAQContext* getTheARTDAQSupervisorContext (void) const;
79 
80  private:
81  std::vector<XDAQContext> contexts_;
82  unsigned int /*contextIndex*/ artdaqSupervisorContext_;
83 
84  public:
86  static struct ColContext
87  {
88  std::string const colContextUID_ = "ContextUID";
89  std::string const colLinkToApplicationTable_ = "LinkToApplicationTable";
90  std::string const colLinkToApplicationGroupID_ = "LinkToApplicationGroupID";
91  std::string const colStatus_ = TableViewColumnInfo::COL_NAME_STATUS;
92  std::string const colId_ = "Id";
93  std::string const colAddress_ = "Address";
94  std::string const colPort_ = "Port";
95  } colContext_;
96 
98  static struct ColApplication
99  {
100  std::string const colApplicationGroupID_ = "ApplicationGroupID";
101  std::string const colApplicationUID_ = "ApplicationUID";
102  std::string const colLinkToSupervisorTable_ = "LinkToSupervisorTable";
103  std::string const colLinkToSupervisorUID_ = "LinkToSupervisorUID";
104  std::string const colStatus_ = TableViewColumnInfo::COL_NAME_STATUS;
105  std::string const colClass_ = "Class";
106  std::string const colId_ = "Id";
107  std::string const colInstance_ = "Instance";
108  std::string const colNetwork_ = "Network";
109  std::string const colGroup_ = "Group";
110  std::string const colModule_ = "Module";
111  std::string const colConfigurePriority_ = "ConfigurePriority";
112  std::string const colStartPriority_ = "StartPriority";
113  std::string const colStopPriority_ = "StopPriority";
114  std::string const colLinkToPropertyTable_ = "LinkToPropertyTable";
115  std::string const colLinkToPropertyGroupID_ = "LinkToPropertyGroupID";
116  } colApplication_;
117 
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  } colAppProperty_;
128 
129 
130  public:
131  static const std::set<std::string> FETypeClassNames_, DMTypeClassNames_,
132  LogbookTypeClassNames_, MacroMakerTypeClassNames_, ChatTypeClassNames_,
133  ConsoleTypeClassNames_, ConfigurationGUITypeClassNames_, CodeEditorTypeClassNames_,
134  VisualizerTypeClassNames_, SlowControlsTypeClassNames_;
135  static const std::string GATEWAY_SUPERVISOR_CLASS, WIZARD_SUPERVISOR_CLASS,
136  DEPRECATED_SUPERVISOR_CLASS, ARTDAQ_SUPERVISOR_CLASS;
137  static const std::map<std::string /*class*/,
138  std::string /*module*/> AppClassModuleLookup_;
139 }; //end XDAQContextTable class
140 } // namespace ots
141 // clang-format on
142 #endif
void outputXDAQXML(std::ostream &out)
void init(ConfigurationManager *configManager)
Methods.
static const std::map< std::string, std::string > AppClassModuleLookup_
NOTE!!! std::next + offset reads std::set from right-to-left above (end to beginning)
std::string getContextUID(const std::string &url) const
void extractContexts(ConfigurationManager *configManager)
std::string getContextOfGateway(ConfigurationManager *configManager) const
only considers ON contexts and applications
const XDAQContext * getTheARTDAQSupervisorContext(void) const
artdaq specific get methods
std::string getContextOfApplication(ConfigurationManager *configManager, const std::string &appUID) const
only considers ON contexts and applications
XDAQ Context Column names.