otsdaq  3.06.00
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  static const unsigned int WIZMODE_APP_ID;
27  static const unsigned int WIZMODE_CONFIG_APP_ID;
28 
29  std::string applicationGroupID_;
30  std::string applicationUID_;
31  bool status_;
32  std::string class_;
33  unsigned int id_;
34  unsigned int instance_;
35  std::string network_;
36  std::string group_;
37  std::string module_;
38  std::string sourceConfig_;
39  std::map<std::string /*FSM command*/, uint8_t /*priority*/>
40  stateMachineCommandPriority_;
41 
42  std::vector<XDAQApplicationProperty> properties_;
43  };
44 
45  struct XDAQContext
46  {
47  std::string contextUID_;
48  std::string sourceConfig_;
49  bool status_;
50  unsigned int id_;
51  std::string address_;
52  unsigned int port_;
53  std::vector<XDAQApplication> applications_;
54  };
55 
56  XDAQContextTable (void);
57  virtual ~XDAQContextTable (void);
58 
60  void init (ConfigurationManager* configManager);
61  void extractContexts (ConfigurationManager* configManager);
62  void outputXDAQXML (std::ostream& out);
67  std::string getContextUID (const std::string& url) const;
68  std::string getApplicationUID (const std::string& url, unsigned int id) const;
69  std::string getContextOfApplication (ConfigurationManager* configManager, const std::string& appUID, bool allowOffContexts = false) const;
70  std::string getContextOfGateway (ConfigurationManager* configManager) const;
71 
72  const std::vector<XDAQContext>& getContexts (void) const { return contexts_; }
73 
74  static ConfigurationTree getContextNode (const ConfigurationManager* configManager, const std::string& contextUID);
75  static ConfigurationTree getApplicationNode (const ConfigurationManager* configManager, const std::string& contextUID, const std::string& appUID);
76  static ConfigurationTree getSupervisorConfigNode (const ConfigurationManager* configManager, const std::string& contextUID, const std::string& appUID);
77  std::string getContextAddress (const std::string& contextUID = "X", bool wantHttp = false) const;
78 
80  const XDAQContext* getTheARTDAQSupervisorContext (void) const;
81 
82  private:
83  std::vector<XDAQContext> contexts_;
84  unsigned int /*contextIndex*/ artdaqSupervisorContext_;
85 
86  public:
88  static struct ColContext
89  {
90  std::string const colContextUID_ = "ContextUID";
91  std::string const colLinkToApplicationTable_ = "LinkToApplicationTable";
92  std::string const colLinkToApplicationGroupID_ = "LinkToApplicationGroupID";
93  std::string const colStatus_ = TableViewColumnInfo::COL_NAME_STATUS;
94  std::string const colId_ = "Id";
95  std::string const colAddress_ = "Address";
96  std::string const colPort_ = "Port";
97  } colContext_;
98 
100  static struct ColApplication
101  {
102  std::string const colApplicationGroupID_ = "ApplicationGroupID";
103  std::string const colApplicationUID_ = "ApplicationUID";
104  std::string const colLinkToSupervisorTable_ = "LinkToSupervisorTable";
105  std::string const colLinkToSupervisorUID_ = "LinkToSupervisorUID";
106  std::string const colStatus_ = TableViewColumnInfo::COL_NAME_STATUS;
107  std::string const colClass_ = "Class";
108  std::string const colId_ = "Id";
109  std::string const colInstance_ = "Instance";
110  std::string const colNetwork_ = "Network";
111  std::string const colGroup_ = "Group";
112  std::string const colModule_ = "Module";
113  std::string const colConfigurePriority_ = "ConfigurePriority";
114  std::string const colStartPriority_ = "StartPriority";
115  std::string const colStopPriority_ = "StopPriority";
116  std::string const colLinkToPropertyTable_ = "LinkToPropertyTable";
117  std::string const colLinkToPropertyGroupID_ = "LinkToPropertyGroupID";
118  } colApplication_;
119 
122  {
123  std::string const colPropertyGroupID_ = "PropertyGroupID";
124  std::string const colPropertyUID_ = "UID";
125  std::string const colStatus_ = TableViewColumnInfo::COL_NAME_STATUS;
126  std::string const colPropertyName_ = "PropertyName";
127  std::string const colPropertyType_ = "PropertyType";
128  std::string const colPropertyValue_ = "PropertyValue";
129  } colAppProperty_;
130 
131 
132  public:
133  static const std::set<std::string> FETypeClassNames_, DMTypeClassNames_,
134  LogbookTypeClassNames_, MacroMakerTypeClassNames_, ChatTypeClassNames_,
135  ConsoleTypeClassNames_, ConfigurationGUITypeClassNames_, CodeEditorTypeClassNames_,
136  VisualizerTypeClassNames_, SlowControlsTypeClassNames_;
137  static const std::string GATEWAY_SUPERVISOR_CLASS, WIZARD_SUPERVISOR_CLASS,
138  DEPRECATED_SUPERVISOR_CLASS, ARTDAQ_SUPERVISOR_CLASS;
139  static const std::map<std::string /*class*/,
140  std::string /*module*/> AppClassModuleLookup_;
141 }; //end XDAQContextTable class
142 } // namespace ots
143 // clang-format on
144 #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
std::string getContextOfApplication(ConfigurationManager *configManager, const std::string &appUID, bool allowOffContexts=false) const
only considers ON contexts and applications, unless off contexts allows
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
defines used also by OtsConfigurationWizardSupervisor
XDAQ Context Column names.