1 #ifndef _ots_ConfigurationTree_h_
2 #define _ots_ConfigurationTree_h_
4 #include "otsdaq/TableCore/TableView.h"
8 class ConfigurationManager;
19 friend class ConfigurationGUISupervisor;
52 __COUT__ <<
"OPERATOR= COPY CONSTRUCTOR ConfigManager: " << configMgr_
53 <<
" configuration: " << table_ << std::endl;
58 __COUT__ <<
"OPERATOR= COPY CONSTRUCTOR CANNOT BE USED - ConfigurationTree is a "
59 "const class. SO YOUR CODE IS WRONG! You should probably instantiate "
60 "and initialize another ConfigurationTree, rather than assigning to "
61 "an existing ConfigurationTree. Crashing now."
63 __COUT__ <<
"OPERATOR= COPY CONSTRUCTOR CANNOT BE USED - ConfigurationTree is a "
64 "const class. SO YOUR CODE IS WRONG! You should probably instantiate "
65 "and initialize another ConfigurationTree, rather than assigning to "
66 "an existing ConfigurationTree. Crashing now."
68 __COUT__ <<
"OPERATOR= COPY CONSTRUCTOR CANNOT BE USED - ConfigurationTree is a "
69 "const class. SO YOUR CODE IS WRONG! You should probably instantiate "
70 "and initialize another ConfigurationTree, rather than assigning to "
71 "an existing ConfigurationTree. Crashing now."
73 __COUT__ <<
"OPERATOR= COPY CONSTRUCTOR CANNOT BE USED - ConfigurationTree is a "
74 "const class. SO YOUR CODE IS WRONG! You should probably instantiate "
75 "and initialize another ConfigurationTree, rather than assigning to "
76 "an existing ConfigurationTree. Crashing now."
78 __COUT__ <<
"OPERATOR= COPY CONSTRUCTOR CANNOT BE USED - ConfigurationTree is a "
79 "const class. SO YOUR CODE IS WRONG! You should probably instantiate "
80 "and initialize another ConfigurationTree, rather than assigning to "
81 "an existing ConfigurationTree. Crashing now."
83 __COUT__ <<
"OPERATOR= COPY CONSTRUCTOR CANNOT BE USED - ConfigurationTree is a "
84 "const class. SO YOUR CODE IS WRONG! You should probably instantiate "
85 "and initialize another ConfigurationTree, rather than assigning to "
86 "an existing ConfigurationTree. Crashing now."
89 StringMacros::stackTrace();
94 configMgr_ = a.configMgr_;
101 tableView_ = a.tableView_;
102 __COUT__ <<
"OPERATOR COPY CONSTRUCTOR" << std::endl;
106 static const std::string DISCONNECTED_VALUE;
107 static const std::string VALUE_TYPE_DISCONNECTED;
108 static const std::string VALUE_TYPE_NODE;
110 static const std::string NODE_TYPE_GROUP_TABLE;
111 static const std::string NODE_TYPE_TABLE;
112 static const std::string NODE_TYPE_GROUP_LINK;
113 static const std::string NODE_TYPE_UID_LINK;
114 static const std::string NODE_TYPE_VALUE;
115 static const std::string NODE_TYPE_UID;
116 static const std::string NODE_TYPE_ROOT;
118 static const std::string ROOT_NAME;
122 BitMap() : isDefault_(
true), zero_(0) {}
125 const uint64_t&
get(
unsigned int row,
unsigned int col)
const
127 return isDefault_ ? zero_ : bitmap_[row][col];
129 unsigned int numberOfRows()
const {
return bitmap_.size(); }
130 unsigned int numberOfColumns(
unsigned int row)
const
132 return bitmap_[row].size();
136 std::vector<std::vector<uint64_t>> bitmap_;
148 void getValue (T& value)
const;
152 void getValue (std::string& value)
const;
161 T getValue (
void)
const;
165 std::string getValue (
void)
const;
170 T handleValidateValueForColumn(
175 std::string handleValidateValueForColumn(
183 ConfigurationTree getNode (
const std::string& nodeName,
bool doNotThrowOnBrokenUIDLinks =
false)
const;
184 ConfigurationTree getBackNode (std::string nodeName,
unsigned int backSteps = 1)
const;
185 ConfigurationTree getForwardNode (std::string nodeName,
unsigned int forwardSteps = 1)
const;
189 const std::string& getTableName (
void)
const;
190 const std::string& getFieldTableName (
void)
const;
192 const time_t& getTableCreationTime (
void)
const;
193 std::vector<std::vector<std::string>> getChildrenNamesByPriority (
bool onlyStatusTrue =
false)
const;
194 std::vector<std::string> getChildrenNames (
bool byPriority =
false,
bool onlyStatusTrue =
false)
const;
195 std::vector<std::vector<std::pair<
197 std::string > filterMap = std::map<std::string /*relative-path*/, std::string /*value*/>(),
198 bool onlyStatusTrue =
false)
const;
199 std::vector<std::pair<std::string,
201 std::string > filterMap = std::map<std::string /*relative-path*/, std::string /*value*/>(),
202 bool byPriority =
false,
203 bool onlyStatusTrue =
false)
const;
204 std::map<std::string, ConfigurationTree> getChildrenMap (
void)
const;
205 std::string getEscapedValue (
void)
const;
206 const std::string& getValueAsString (
bool returnLinkTableValue =
false)
const;
207 const std::string& getUIDAsString (
void)
const;
208 const std::string& getValueDataType (
void)
const;
209 const std::string& getValueType (
void)
const;
210 const std::string& getValueName (
void)
const;
211 inline const std::string& getFieldName (
void)
const {
return getValueName(); }
212 std::string getNodeType (
void)
const;
213 const unsigned int& getNodeRow (
void)
const;
214 const std::string& getDisconnectedTableName (
void)
const;
215 const std::string& getDisconnectedLinkID (
void)
const;
216 const std::string& getChildLinkIndex (
void)
const;
217 std::vector<std::string> getFixedChoices (
void)
const;
221 bool isDefaultValue (
void)
const;
222 inline bool isRootNode (
void)
const;
223 inline bool isTableNode (
void)
const;
224 bool isValueNode (
void)
const;
225 bool isValueBoolType (
void)
const;
226 bool isValueNumberDataType (
void)
const;
227 bool isDisconnected (
void)
const;
228 bool isLinkNode (
void)
const;
229 bool isGroupLinkNode (
void)
const;
230 bool isUIDLinkNode (
void)
const;
231 bool isGroupIDNode (
void)
const;
232 bool isUIDNode (
void)
const;
233 bool isEnabled (
void)
const;
234 inline bool status (
void)
const;
236 void print (
const unsigned int& depth = -1, std::ostream& out = std::cout)
const;
237 std::string nodeDump (
void)
const;
240 friend std::ostream& operator<< (
241 std::ostream& out,
const ConfigurationTree& t)
243 out << t.getValueAsString();
248 const unsigned int& getRow (
void)
const;
249 const unsigned int& getColumn (
void)
const;
250 const unsigned int& getFieldRow (
void)
const;
251 const unsigned int& getFieldColumn (
void)
const;
252 const TableViewColumnInfo& getColumnInfo (
void)
const;
258 const std::string& uid,
259 const std::string& columnName,
260 const std::string& relativePath,
263 , columnName_(columnName)
264 , relativePath_(relativePath)
265 , columnInfo_(columnInfo)
269 std::string tableName_, columnName_, relativePath_;
274 std::vector<ConfigurationTree::RecordField> getCommonFields (
275 const std::vector<std::string /*relative-path*/>& recordList,
276 const std::vector<std::string /*relative-path*/>& fieldAcceptList,
277 const std::vector<std::string /*relative-path*/>& fieldRejectList,
278 unsigned int depth = -1,
279 bool autoSelectFilterFields =
false)
const;
280 std::set<std::string > getUniqueValuesForField (
281 const std::vector<std::string /*relative-path*/>& recordList,
282 const std::string& fieldName,
283 std::string* fieldGroupIDChildLinkIndex = 0)
const;
289 const std::string& groupId,
290 const TableBase*
const& linkParentConfig,
291 const std::string& linkColName,
292 const std::string& linkColValue,
293 const unsigned int linkBackRow,
294 const unsigned int linkBackCol,
295 const std::string& disconnectedTargetName,
296 const std::string& disconnectedLinkID,
297 const std::string& childLinkIndex,
298 const unsigned int row = TableView::INVALID,
299 const unsigned int col = TableView::INVALID);
302 ConfigurationTree recursiveGetNode (
const std::string& nodeName,
bool doNotThrowOnBrokenUIDLinks,
const std::string& originalNodeString)
const;
303 static void recursivePrint (
const ConfigurationTree& t,
unsigned int depth, std::ostream& out, std::string space);
305 void recursiveGetCommonFields (
306 std::vector<ConfigurationTree::RecordField>& fieldCandidateList,
307 std::vector<int>& fieldCount,
308 const std::vector<std::string /*relative-path*/>& fieldAcceptList,
309 const std::vector<std::string /*relative-path*/>& fieldRejectList,
311 const std::string& relativePathBase,
312 bool inFirstRecord)
const;
323 const std::string groupId_;
326 const std::string linkColName_;
327 const std::string linkColValue_;
328 const unsigned int linkBackRow_;
329 const unsigned int linkBackCol_;
330 const std::string disconnectedTargetName_;
332 const std::string disconnectedLinkID_;
333 const std::string childLinkIndex_;
334 const unsigned int row_;
335 const unsigned int col_;
339 #include "otsdaq/ConfigurationInterface/ConfigurationTree.icc"