1 #ifndef _ots_ConfigurationTree_h_
2 #define _ots_ConfigurationTree_h_
4 #include "otsdaq-core/TableCore/TableView.h"
8 class ConfigurationManager;
19 friend class ConfigurationGUISupervisor;
51 __COUT__ <<
"OPERATOR= COPY CONSTRUCTOR ConfigManager: " << configMgr_
52 <<
" configuration: " << table_ << std::endl;
57 __COUT__ <<
"OPERATOR= COPY CONSTRUCTOR CANNOT BE USED - ConfigurationTree is a "
58 "const class. SO YOUR CODE IS WRONG! You should probably instantiate "
59 "and initialize another ConfigurationTree, rather than assigning to "
60 "an existing ConfigurationTree. Crashing now."
62 __COUT__ <<
"OPERATOR= COPY CONSTRUCTOR CANNOT BE USED - ConfigurationTree is a "
63 "const class. SO YOUR CODE IS WRONG! You should probably instantiate "
64 "and initialize another ConfigurationTree, rather than assigning to "
65 "an existing ConfigurationTree. Crashing now."
67 __COUT__ <<
"OPERATOR= COPY CONSTRUCTOR CANNOT BE USED - ConfigurationTree is a "
68 "const class. SO YOUR CODE IS WRONG! You should probably instantiate "
69 "and initialize another ConfigurationTree, rather than assigning to "
70 "an existing ConfigurationTree. Crashing now."
72 __COUT__ <<
"OPERATOR= COPY CONSTRUCTOR CANNOT BE USED - ConfigurationTree is a "
73 "const class. SO YOUR CODE IS WRONG! You should probably instantiate "
74 "and initialize another ConfigurationTree, rather than assigning to "
75 "an existing ConfigurationTree. Crashing now."
77 __COUT__ <<
"OPERATOR= COPY CONSTRUCTOR CANNOT BE USED - ConfigurationTree is a "
78 "const class. SO YOUR CODE IS WRONG! You should probably instantiate "
79 "and initialize another ConfigurationTree, rather than assigning to "
80 "an existing ConfigurationTree. Crashing now."
82 __COUT__ <<
"OPERATOR= COPY CONSTRUCTOR CANNOT BE USED - ConfigurationTree is a "
83 "const class. SO YOUR CODE IS WRONG! You should probably instantiate "
84 "and initialize another ConfigurationTree, rather than assigning to "
85 "an existing ConfigurationTree. Crashing now."
91 configMgr_ = a.configMgr_;
98 tableView_ = a.tableView_;
99 __COUT__ <<
"OPERATOR COPY CONSTRUCTOR" << std::endl;
103 static const std::string DISCONNECTED_VALUE;
104 static const std::string VALUE_TYPE_DISCONNECTED;
105 static const std::string VALUE_TYPE_NODE;
107 static const std::string NODE_TYPE_GROUP_TABLE;
108 static const std::string NODE_TYPE_TABLE;
109 static const std::string NODE_TYPE_GROUP_LINK;
110 static const std::string NODE_TYPE_UID_LINK;
111 static const std::string NODE_TYPE_VALUE;
112 static const std::string NODE_TYPE_UID;
113 static const std::string NODE_TYPE_ROOT;
117 BitMap() : isDefault_(
true), zero_(0) {}
120 const uint64_t&
get(
unsigned int row,
unsigned int col)
const
122 return isDefault_ ? zero_ : bitmap_[row][col];
124 unsigned int numberOfRows()
const {
return bitmap_.size(); }
125 unsigned int numberOfColumns(
unsigned int row)
const
127 return bitmap_[row].size();
131 std::vector<std::vector<uint64_t>> bitmap_;
143 void getValue(T& value)
const;
147 void getValue(std::string& value)
const;
156 T getValue(
void)
const;
160 std::string getValue(
void)
const;
165 T handleValidateValueForColumn(
170 std::string handleValidateValueForColumn(
const TableView* configView,
178 bool doNotThrowOnBrokenUIDLinks =
false)
const;
179 ConfigurationTree getBackNode(std::string nodeName,
unsigned int backSteps = 1)
const;
181 unsigned int forwardSteps = 1)
const;
185 const std::string& getTableName(
void)
const;
186 const std::string& getFieldTableName(
void)
const;
188 const time_t& getTableCreationTime(
void)
const;
189 std::vector<std::vector<std::string>> getChildrenNamesByPriority(
190 bool onlyStatusTrue =
false)
const;
191 std::vector<std::string> getChildrenNames(
bool byPriority =
false,
192 bool onlyStatusTrue =
false)
const;
193 std::vector<std::vector<std::pair<std::string, ConfigurationTree>>>
194 getChildrenByPriority(
195 std::map<std::string /*relative-path*/, std::string /*value*/> filterMap =
196 std::map<std::string /*relative-path*/, std::string /*value*/>(),
197 bool onlyStatusTrue =
false)
const;
198 std::vector<std::pair<std::string, ConfigurationTree>> getChildren(
199 std::map<std::string /*relative-path*/, std::string /*value*/> filterMap =
200 std::map<std::string /*relative-path*/, std::string /*value*/>(),
201 bool byPriority =
false,
202 bool onlyStatusTrue =
false)
const;
203 std::map<std::string, ConfigurationTree> getChildrenMap(
void)
const;
204 std::string getEscapedValue(
void)
const;
205 const std::string& getValueAsString(
bool returnLinkTableValue =
false)
const;
206 const std::string& getUIDAsString(
void)
const;
207 const std::string& getValueDataType(
void)
const;
208 const std::string& getValueType(
void)
const;
209 const std::string& getValueName(
void)
const;
210 std::string getNodeType(
void)
const;
211 const std::string& getDisconnectedTableName(
void)
const;
212 const std::string& getDisconnectedLinkID(
void)
const;
213 const std::string& getChildLinkIndex(
void)
const;
214 std::vector<std::string> getFixedChoices(
void)
const;
218 bool isDefaultValue(
void)
const;
219 bool isRootNode(
void)
const;
220 bool isConfigurationNode(
void)
const;
221 bool isValueNode(
void)
const;
222 bool isValueBoolType(
void)
const;
223 bool isValueNumberDataType(
void)
const;
224 bool isDisconnected(
void)
const;
225 bool isLinkNode(
void)
const;
226 bool isGroupLinkNode(
void)
const;
227 bool isUIDLinkNode(
void)
const;
228 bool isUIDNode(
void)
const;
230 void print(
const unsigned int& depth = -1, std::ostream& out = std::cout)
const;
231 std::string nodeDump(
void)
const;
236 out << t.getValueAsString();
241 const unsigned int& getRow(
void)
const;
242 const unsigned int& getColumn(
void)
const;
243 const unsigned int& getFieldRow(
void)
const;
244 const unsigned int& getFieldColumn(
void)
const;
245 const TableViewColumnInfo& getColumnInfo(
void)
const;
251 const std::string& uid,
252 const std::string& columnName,
253 const std::string& relativePath,
256 , columnName_(columnName)
257 , relativePath_(relativePath)
258 , columnInfo_(columnInfo)
262 std::string tableName_, columnName_, relativePath_;
267 std::vector<ConfigurationTree::RecordField> getCommonFields(
268 const std::vector<std::string /*relative-path*/>& recordList,
269 const std::vector<std::string /*relative-path*/>& fieldAcceptList,
270 const std::vector<std::string /*relative-path*/>& fieldRejectList,
271 unsigned int depth = -1)
const;
272 std::set<std::string > getUniqueValuesForField(
273 const std::vector<std::string /*relative-path*/>& recordList,
274 const std::string& fieldName)
const;
280 const std::string& groupId,
281 const TableBase*
const& linkParentConfig,
282 const std::string& linkColName,
283 const std::string& linkColValue,
284 const unsigned int linkBackRow,
285 const unsigned int linkBackCol,
286 const std::string& disconnectedTargetName,
287 const std::string& disconnectedLinkID,
288 const std::string& childLinkIndex,
289 const unsigned int row = TableView::INVALID,
290 const unsigned int col = TableView::INVALID);
293 const std::string& childPath,
294 bool doNotThrowOnBrokenUIDLinks,
295 const std::string& originalNodeString);
297 bool doNotThrowOnBrokenUIDLinks,
298 const std::string& originalNodeString)
const;
304 void recursiveGetCommonFields(
305 std::vector<ConfigurationTree::RecordField>& fieldCandidateList,
306 std::vector<int>& fieldCount,
307 const std::vector<std::string /*relative-path*/>& fieldAcceptList,
308 const std::vector<std::string /*relative-path*/>& fieldRejectList,
310 const std::string& relativePathBase,
311 bool inFirstRecord)
const;
322 const std::string groupId_;
325 const std::string linkColName_;
326 const std::string linkColValue_;
327 const unsigned int linkBackRow_;
328 const unsigned int linkBackCol_;
329 const std::string disconnectedTargetName_;
333 const std::string childLinkIndex_;
334 const unsigned int row_;
335 const unsigned int col_;
339 #include "otsdaq-core/ConfigurationInterface/ConfigurationTree.icc"