1 #ifndef _ots_ConfigurationTree_h_
2 #define _ots_ConfigurationTree_h_
4 #include "otsdaq/TableCore/TableView.h"
8 class ConfigurationManager;
19 friend class ConfigurationGUISupervisor;
53 __COUT__ <<
"OPERATOR= COPY CONSTRUCTOR ConfigManager: " << configMgr_
54 <<
" configuration: " << table_ << std::endl;
59 __COUT__ <<
"OPERATOR= COPY CONSTRUCTOR CANNOT BE USED - ConfigurationTree is a "
60 "const class. SO YOUR CODE IS WRONG! You should probably instantiate "
61 "and initialize another ConfigurationTree, rather than assigning to "
62 "an existing ConfigurationTree. Crashing now."
64 __COUT__ <<
"OPERATOR= COPY CONSTRUCTOR CANNOT BE USED - ConfigurationTree is a "
65 "const class. SO YOUR CODE IS WRONG! You should probably instantiate "
66 "and initialize another ConfigurationTree, rather than assigning to "
67 "an existing ConfigurationTree. Crashing now."
69 __COUT__ <<
"OPERATOR= COPY CONSTRUCTOR CANNOT BE USED - ConfigurationTree is a "
70 "const class. SO YOUR CODE IS WRONG! You should probably instantiate "
71 "and initialize another ConfigurationTree, rather than assigning to "
72 "an existing ConfigurationTree. Crashing now."
74 __COUT__ <<
"OPERATOR= COPY CONSTRUCTOR CANNOT BE USED - ConfigurationTree is a "
75 "const class. SO YOUR CODE IS WRONG! You should probably instantiate "
76 "and initialize another ConfigurationTree, rather than assigning to "
77 "an existing ConfigurationTree. Crashing now."
79 __COUT__ <<
"OPERATOR= COPY CONSTRUCTOR CANNOT BE USED - ConfigurationTree is a "
80 "const class. SO YOUR CODE IS WRONG! You should probably instantiate "
81 "and initialize another ConfigurationTree, rather than assigning to "
82 "an existing ConfigurationTree. Crashing now."
84 __COUT__ <<
"OPERATOR= COPY CONSTRUCTOR CANNOT BE USED - ConfigurationTree is a "
85 "const class. SO YOUR CODE IS WRONG! You should probably instantiate "
86 "and initialize another ConfigurationTree, rather than assigning to "
87 "an existing ConfigurationTree. Crashing now."
90 StringMacros::stackTrace();
95 configMgr_ = a.configMgr_;
102 tableView_ = a.tableView_;
103 __COUT__ <<
"OPERATOR COPY CONSTRUCTOR" << std::endl;
107 static const std::string DISCONNECTED_VALUE;
108 static const std::string VALUE_TYPE_DISCONNECTED;
109 static const std::string VALUE_TYPE_NODE;
111 static const std::string NODE_TYPE_GROUP_TABLE;
112 static const std::string NODE_TYPE_TABLE;
113 static const std::string NODE_TYPE_GROUP_LINK;
114 static const std::string NODE_TYPE_UID_LINK;
115 static const std::string NODE_TYPE_VALUE;
116 static const std::string NODE_TYPE_UID;
117 static const std::string NODE_TYPE_ROOT;
119 static const std::string ROOT_NAME;
123 BitMap() : isDefault_(
true), zero_(0) {}
126 const uint64_t&
get(
unsigned int row,
unsigned int col)
const
128 return isDefault_ ? zero_ : bitmap_[row][col];
130 unsigned int numberOfRows()
const {
return bitmap_.size(); }
131 unsigned int numberOfColumns(
unsigned int row)
const
133 return bitmap_[row].size();
137 std::vector<std::vector<uint64_t>> bitmap_;
149 void getValue (T& value)
const;
153 void getValue (std::string& value)
const;
162 T getValue (
void)
const;
164 T getValueWithDefault (
const T& defaultValue)
const;
168 std::string getValue (
void)
const;
169 std::string getValueWithDefault (
const std::string& defaultValue)
const;
174 T handleValidateValueForColumn(
179 std::string handleValidateValueForColumn(
187 ConfigurationTree getNode (
const std::string& nodeName,
bool doNotThrowOnBrokenUIDLinks =
false)
const;
188 ConfigurationTree getBackNode (std::string nodeName,
unsigned int backSteps = 1)
const;
189 ConfigurationTree getForwardNode (std::string nodeName,
unsigned int forwardSteps = 1)
const;
193 const std::string& getTableName (
void)
const;
194 const std::string& getFieldTableName (
void)
const;
196 const time_t& getTableCreationTime (
void)
const;
197 std::vector<std::vector<std::string>> getChildrenNamesByPriority (
bool onlyStatusTrue =
false)
const;
198 std::vector<std::string> getChildrenNames (
bool byPriority =
false,
bool onlyStatusTrue =
false)
const;
199 std::vector<std::vector<std::pair<
201 std::string > filterMap = std::map<std::string /*relative-path*/, std::string /*value*/>(),
202 bool onlyStatusTrue =
false)
const;
203 std::vector<std::pair<std::string,
205 std::string > filterMap = std::map<std::string /*relative-path*/, std::string /*value*/>(),
206 bool byPriority =
false,
207 bool onlyStatusTrue =
false)
const;
208 std::map<std::string, ConfigurationTree> getChildrenMap (
void)
const;
209 std::string getEscapedValue (
void)
const;
210 const std::string& getValueAsString (
bool returnLinkTableValue =
false)
const;
211 const std::string& getUIDAsString (
void)
const;
212 const std::string& getValueDataType (
void)
const;
213 const std::string& getValueType (
void)
const;
214 const std::string& getValueName (
void)
const;
215 const std::string& getDefaultValue (
void)
const;
216 inline const std::string& getFieldName (
void)
const {
return getValueName(); }
217 std::string getNodeType (
void)
const;
218 const unsigned int& getNodeRow (
void)
const;
219 const std::string& getDisconnectedTableName (
void)
const;
220 const std::string& getDisconnectedLinkID (
void)
const;
221 const std::string& getChildLinkIndex (
void)
const;
222 std::vector<std::string> getFixedChoices (
void)
const;
223 std::set<std::string> getSetOfGroupIDs (
void)
const;
227 bool isDefaultValue (
void)
const;
228 inline bool isRootNode (
void)
const;
229 inline bool isTableNode (
void)
const;
230 bool isValueNode (
void)
const;
231 bool isValueBoolType (
void)
const;
232 bool isValueNumberDataType (
void)
const;
233 bool isDisconnected (
void)
const;
234 bool isLinkNode (
void)
const;
235 bool isGroupLinkNode (
void)
const;
236 bool isUIDLinkNode (
void)
const;
237 bool isGroupIDNode (
void)
const;
238 bool isUIDNode (
void)
const;
239 bool isStatusNode (
void)
const;
240 bool isEnabled (
void)
const;
241 inline bool status (
void)
const {
return isEnabled(); }
243 void print (
const unsigned int& depth = -1, std::ostream& out = std::cout)
const;
244 std::string nodeDump (
void)
const;
247 friend std::ostream& operator<< (
248 std::ostream& out,
const ConfigurationTree& t)
250 out << t.getValueAsString();
255 const unsigned int& getRow (
void)
const;
256 const unsigned int& getColumn (
void)
const;
257 const unsigned int& getFieldRow (
void)
const;
258 const unsigned int& getFieldColumn (
void)
const;
259 const TableViewColumnInfo& getColumnInfo (
void)
const;
266 const std::string& columnName,
267 const std::string& relativePath,
270 , columnName_(columnName)
271 , relativePath_(relativePath)
272 , columnInfo_(columnInfo)
276 std::string tableName_, columnName_, relativePath_;
281 std::vector<ConfigurationTree::RecordField> getCommonFields (
282 const std::vector<std::string /*relative-path*/>& recordList,
283 const std::vector<std::string /*relative-path*/>& fieldAcceptList,
284 const std::vector<std::string /*relative-path*/>& fieldRejectList,
285 unsigned int depth = -1,
286 bool autoSelectFilterFields =
false)
const;
287 std::set<std::string > getUniqueValuesForField (
288 const std::vector<std::string /*relative-path*/>& recordList,
289 const std::string& fieldName,
290 std::string* fieldGroupIDChildLinkIndex = 0)
const;
296 const std::string& groupId,
297 const TableBase*
const& linkParentConfig,
298 const std::string& linkColName,
299 const std::string& linkColValue,
300 const unsigned int linkBackRow,
301 const unsigned int linkBackCol,
302 const std::string& disconnectedTargetName,
303 const std::string& disconnectedLinkID,
304 const std::string& childLinkIndex,
305 const unsigned int row = TableView::INVALID,
306 const unsigned int col = TableView::INVALID);
309 ConfigurationTree recursiveGetNode (
const std::string& nodeName,
bool doNotThrowOnBrokenUIDLinks,
const std::string& originalNodeString)
const;
310 static void recursivePrint (
const ConfigurationTree& t,
unsigned int depth, std::ostream& out, std::string space);
312 void recursiveGetCommonFields (
313 std::vector<ConfigurationTree::RecordField>& fieldCandidateList,
314 std::vector<int>& fieldCount,
315 const std::vector<std::string /*relative-path*/>& fieldAcceptList,
316 const std::vector<std::string /*relative-path*/>& fieldRejectList,
318 const std::string& relativePathBase,
319 bool inFirstRecord)
const;
330 const std::string groupId_;
333 const std::string linkColName_;
334 const std::string linkColValue_;
335 const unsigned int linkBackRow_;
336 const unsigned int linkBackCol_;
337 const std::string disconnectedTargetName_;
339 const std::string disconnectedLinkID_;
340 const std::string childLinkIndex_;
341 const unsigned int row_;
342 const unsigned int col_;
346 #include "otsdaq/ConfigurationInterface/ConfigurationTree.icc"