1 #include "otsdaq/ConfigurationInterface/ConfigurationTree.h"
5 #include "otsdaq/ConfigurationInterface/ConfigurationManager.h"
6 #include "otsdaq/Macros/StringMacros.h"
7 #include "otsdaq/TableCore/TableBase.h"
12 #define __MF_SUBJECT__ "ConfigurationTree"
14 const std::string ConfigurationTree::DISCONNECTED_VALUE =
"X";
15 const std::string ConfigurationTree::VALUE_TYPE_DISCONNECTED =
"Disconnected";
16 const std::string ConfigurationTree::VALUE_TYPE_NODE =
"Node";
17 const std::string ConfigurationTree::ROOT_NAME =
"/";
18 time_t ConfigurationTree::LAST_NODE_DUMP_TIME = 0;
30 , disconnectedTargetName_(
"")
31 , disconnectedLinkID_(
"")
67 const std::string& groupId,
69 const std::string& linkColName,
70 const std::string& linkColValue,
71 const unsigned int linkBackRow,
72 const unsigned int linkBackCol,
73 const std::string& disconnectedTargetName,
74 const std::string& disconnectedLinkID,
75 const std::string& childLinkIndex,
76 const unsigned int row,
77 const unsigned int col)
78 : configMgr_(configMgr)
81 , linkParentTable_(linkParentConfig)
82 , linkColName_(linkColName)
83 , linkColValue_(linkColValue)
84 , linkBackRow_(linkBackRow)
85 , linkBackCol_(linkBackCol)
86 , disconnectedTargetName_(disconnectedTargetName)
87 , disconnectedLinkID_(disconnectedLinkID)
88 , childLinkIndex_(childLinkIndex)
95 __SS__ <<
"Invalid empty pointer given to tree!\n"
96 <<
"\n\tconfigMgr_=" << configMgr_ <<
"\n\tconfiguration_=" << table_
97 <<
"\n\tconfigView_=" << tableView_ << __E__;
104 tableView_ = &(table_->getView());
107 if(tableView_ && tableView_->getColumnInfo(tableView_->
getColUID()).getType() !=
110 __SS__ <<
"Missing UID column (must column of type "
112 <<
") in config view : " << tableView_->getTableName() << __E__;
134 recursivePrint(*
this, depth, out,
"\t");
167 out << space <<
"{" << __E__;
169 recursivePrint(c.second, depth - 1, out, space +
" ");
171 out << space <<
"}" << __E__;
177 std::string ConfigurationTree::handleValidateValueForColumn(
185 __SS__ <<
"Null configView" << __E__;
190 __COUT__ <<
"handleValidateValueForColumn<string>" << __E__;
203 if(row_ != TableView::INVALID &&
204 col_ != TableView::INVALID)
211 __COUT__ <<
"Success following path to tree node!" << __E__;
222 __COUT__ <<
"Successful value!" << __E__;
236 tableView_->
getValue(value, row_, col_);
238 else if(row_ == TableView::INVALID &&
239 col_ == TableView::INVALID)
246 value = (groupId_ ==
"") ? table_->
getTableName() : groupId_;
248 else if(row_ == TableView::INVALID)
250 __SS__ <<
"Malformed ConfigurationTree" << __E__;
253 else if(col_ == TableView::INVALID)
257 __SS__ <<
"Impossible." << __E__;
307 void ConfigurationTree::getValueAsBitMap(
310 __COUTS__(2) << row_ <<
" " << col_ <<
" p: " << tableView_ << __E__;
312 if(row_ != TableView::INVALID &&
313 col_ != TableView::INVALID)
315 std::string bitmapString;
316 tableView_->
getValue(bitmapString, row_, col_);
320 __COUTVS__(2, bitmapString);
321 if(bitmapString == TableViewColumnInfo::DATATYPE_STRING_DEFAULT ||
322 bitmapString == TableViewColumnInfo::DATATYPE_STRING_ALT_DEFAULT)
324 bitmap.isDefault_ =
true;
326 for(
unsigned int r = 0; r < bmp.numOfRows_; ++r)
328 bitmap.bitmap_.push_back(std::vector<std::string>());
329 for(
unsigned int c = 0; c < bmp.numOfColumns_; ++c)
330 bitmap.bitmap_[r].push_back(std::string());
335 bitmap.isDefault_ =
false;
339 std::map<std::string, size_t> valueMap;
340 std::vector<std::string> valueList;
341 if(bmp.mapsToStrings_)
345 for(
size_t i = 0; i < valueList.size(); ++i)
346 valueMap.emplace(std::make_pair(valueList[i], i));
352 bitmap.bitmap_.clear();
354 bool openRow =
false;
355 unsigned int startInt = -1;
356 for(
unsigned int i = 0; i < bitmapString.length(); i++)
358 __COUTVS__(2, bitmapString[i]);
360 __COUTVS__(2, openRow);
361 __COUTVS__(2, startInt);
366 if(bitmapString[i] ==
'[')
370 bitmap.bitmap_.push_back(std::vector<std::string>());
372 else if(bitmapString[i] ==
']')
376 else if(bitmapString[i] ==
',')
383 else if(startInt == (
unsigned int)-1)
385 if(bitmapString[i] ==
']')
390 else if((bitmapString[i] ==
'-') || (bitmapString[i] ==
'+') ||
391 (bitmapString[i] >=
'0' &&
392 bitmapString[i] <=
'9') ||
393 (bmp.mapsToStrings_ && bitmapString[i] >=
'a' &&
396 (bmp.mapsToStrings_ && bitmapString[i] >=
'A' &&
397 bitmapString[i] <=
'Z'))
401 else if(bitmapString[i] ==
',')
403 __SS__ <<
"Too many ',' characters in bit map configuration"
414 if(bitmapString[i] ==
421 bool wasEndQuote =
false;
422 while(ii > startInt && (bitmapString[ii - 1] ==
' ' ||
423 bitmapString[ii - 1] ==
'\r' ||
424 bitmapString[ii - 1] ==
'\n' ||
425 bitmapString[ii - 1] ==
'\t' ||
426 bitmapString[ii - 1] ==
'"'))
428 if(bitmapString[ii - 1] ==
'"')
432 __COUTVS__(2, bitmapString.substr(startInt, ii - startInt));
433 if(bmp.mapsToStrings_)
438 bitmapString.substr(startInt, ii - startInt));
440 catch(
const std::out_of_range& e)
443 << bitmapString.substr(startInt, ii - startInt)
444 <<
"' not found in map-to-string list for bitmap "
446 << tableView_->getColumnInfo(col_).getName()
448 __COUTVS__(2, wasEndQuote);
452 <<
"No end-quote, assuming value is integer "
453 "index into map-to-string list."
459 bitmapString.substr(startInt, ii - startInt));
463 ss <<
"Interpreting value as integer index "
465 << bitmapString.substr(startInt, ii - startInt)
469 if(index >= valueList.size())
471 ss <<
"Interpreting as index [" << index
472 <<
"] is also out of range for map-to-string "
474 << valueList.size() << __E__;
477 value = valueList[index];
482 __COUTVS__(2, value);
485 bitmap.bitmap_[row].push_back(
486 bitmapString.substr(startInt, ii - startInt));
490 else if(bitmapString[i] ==
',')
494 bool wasEndQuote =
false;
495 while(ii > startInt && (bitmapString[ii - 1] ==
' ' ||
496 bitmapString[ii - 1] ==
'\r' ||
497 bitmapString[ii - 1] ==
'\n' ||
498 bitmapString[ii - 1] ==
'\t' ||
499 bitmapString[ii - 1] ==
'"'))
501 if(bitmapString[ii - 1] ==
'"')
505 __COUTVS__(2, bitmapString.substr(startInt, ii - startInt));
506 if(bmp.mapsToStrings_)
511 bitmapString.substr(startInt, ii - startInt));
513 catch(
const std::out_of_range& e)
516 << bitmapString.substr(startInt, ii - startInt)
517 <<
"' not found in map-to-string list for bitmap "
519 << tableView_->getColumnInfo(col_).getName()
521 __COUTVS__(2, wasEndQuote);
525 <<
"No end-quote, assuming value is integer "
526 "index into map-to-string list."
532 bitmapString.substr(startInt, ii - startInt));
536 ss <<
"Interpreting value as integer index "
538 << bitmapString.substr(startInt, ii - startInt)
542 if(index >= valueList.size())
544 ss <<
"Interpreting as index [" << index
545 <<
"] is also out of range for map-to-string "
547 << valueList.size() << __E__;
550 value = valueList[index];
555 __COUTVS__(2, value);
558 bitmap.bitmap_[row].push_back(
559 bitmapString.substr(startInt, ii - startInt));
568 for(
unsigned int r = 0; r < bitmap.bitmap_.size(); ++r)
570 for(
unsigned int c = 0; c < bitmap.bitmap_[r].size(); ++c)
573 << r <<
"," << c <<
" = " << bitmap.bitmap_[r][c] << __E__;
575 __COUTS__(2) <<
"================" << __E__;
580 if(bitmap.bitmap_.size() != bmp.numOfRows_ ||
581 (bmp.numOfRows_ && bitmap.bitmap_[0].size() != bmp.numOfColumns_))
584 <<
"Illegal mismatch in number of rows and columns. Extracted data was "
585 << bitmap.bitmap_.size() <<
" x "
586 << (bitmap.bitmap_.size() ? bitmap.bitmap_[0].size() : 0)
587 <<
" and the expected size is " << bmp.numOfRows_ <<
" x "
588 << bmp.numOfColumns_ << __E__;
594 __SS__ <<
"Requesting getValue must be on a value node." << __E__;
608 ConfigurationTree::getValueAsBitMap(value);
617 if(row_ != TableView::INVALID &&
618 col_ != TableView::INVALID)
621 __SS__ <<
"Can not get escaped value except from a value node!"
622 <<
" This node is type '" << getNodeType() <<
"." << __E__;
634 __SS__ <<
"Can not get configuration name of node with no configuration pointer! "
635 <<
"Is there a broken link? " << __E__;
638 ss <<
"Error occurred traversing from " << linkParentTable_->
getTableName()
641 linkBackRow_, linkParentTable_->getView().
getColUID())
642 <<
"' at row " << linkBackRow_ <<
" col '"
643 << linkParentTable_->getView().getColumnInfo(linkBackCol_).getName()
661 __SS__ <<
"Can not get parent table name of node with no parent table pointer! "
662 <<
"Was this node initialized correctly? " << __E__;
671 if(linkParentTable_ && linkBackRow_ != TableView::INVALID)
674 return linkParentTable_->getView()
675 .getDataView()[linkBackRow_][linkParentTable_->getView().
getColUID()];
678 __SS__ <<
"Can not get parent record name of node without the parent table pointer "
679 << (linkParentTable_ ?
"" :
"= null ") <<
"and row (row = " << linkBackRow_
680 <<
")! Was this node initialized correctly? " << __E__;
689 if(linkParentTable_ && linkBackRow_ != TableView::INVALID &&
690 linkBackCol_ != TableView::INVALID)
693 return linkParentTable_->getView().getColumnInfo(linkBackCol_).getName();
697 <<
"Can not get parent link column name of node without the parent table pointer "
698 << (linkParentTable_ ?
"" :
"= null ") <<
"and row (row = " << linkBackRow_
699 <<
") and col (col = " << linkBackCol_
700 <<
")! Was this node initialized correctly? " << __E__;
709 if(linkParentTable_ && linkBackRow_ != TableView::INVALID &&
710 linkBackCol_ != TableView::INVALID)
714 std::pair<
unsigned int ,
unsigned int > linkPair;
715 linkParentTable_->getView().
getChildLink(linkBackCol_, isGroup, linkPair);
718 linkParentTable_->getView().
getValue(
719 linkId, linkBackRow_, linkPair.second );
724 __SS__ <<
"Can not get parent link ID of node without the parent table pointer "
725 << (linkParentTable_ ?
"" :
"= null ") <<
"and row (row = " << linkBackRow_
726 <<
") and col (col = " << linkBackCol_
727 <<
")! Was this node initialized correctly? " << __E__;
736 if(linkParentTable_ && linkBackRow_ != TableView::INVALID &&
737 linkBackCol_ != TableView::INVALID)
740 return linkParentTable_->getView()
741 .getColumnInfo(linkBackCol_)
745 __SS__ <<
"Can not get parent link index of node without the parent table pointer "
746 << (linkParentTable_ ?
"" :
"= null ") <<
"and row (row = " << linkBackRow_
747 <<
") and col (col = " << linkBackCol_
748 <<
")! Was this node initialized correctly? " << __E__;
760 __SS__ <<
"Can only get row from a UID or value node!" << __E__;
763 ss <<
"Error occurred traversing from " << linkParentTable_->
getTableName()
766 linkBackRow_, linkParentTable_->getView().
getColUID())
767 <<
"' at row " << linkBackRow_ <<
" col '"
768 << linkParentTable_->getView().getColumnInfo(linkBackCol_).getName() <<
".'"
788 if(!linkParentTable_)
790 __SS__ <<
"Can not get configuration name of link node field with no parent "
791 "configuration pointer!"
807 return disconnectedTargetName_;
809 __SS__ <<
"Can not get disconnected target name of node unless it is a disconnected "
822 return disconnectedLinkID_;
824 __SS__ <<
"Can not get disconnected target name of node unless it is a disconnected "
838 __SS__ <<
"Can not get configuration version of node with no config view pointer!"
844 return tableView_->getVersion();
853 __SS__ <<
"Can not get configuration creation time of node with no config view "
860 return tableView_->getCreationTime();
870 __SS__ <<
"Can not get set of group IDs of node with value type of '"
871 << getNodeType() <<
".' Node must be a GroupID node." << __E__;
887 if(
getValueType() != TableViewColumnInfo::TYPE_FIXED_CHOICE_DATA &&
890 __SS__ <<
"Can not get fixed choices of node with value type of '"
891 <<
getValueType() <<
".' Node must be a link or a value node with type '"
892 << TableViewColumnInfo::TYPE_BITMAP_DATA <<
"' or '"
893 << TableViewColumnInfo::TYPE_FIXED_CHOICE_DATA <<
".'" << __E__;
899 std::vector<std::string> retVec;
903 if(!linkParentTable_)
906 <<
"Can not get fixed choices of node with no parent config view pointer!"
919 const TableView* parentView = &(linkParentTable_->getView());
920 int c = parentView->
findCol(linkColName_);
922 std::pair<
unsigned int ,
unsigned int > linkPair;
927 std::vector<std::string> choices = parentView->getColumnInfo(c).getDataChoices();
928 for(
const auto& choice : choices)
929 retVec.push_back(choice);
936 __SS__ <<
"Can not get fixed choices of node with no config view pointer!"
945 std::vector<std::string> choices = tableView_->getColumnInfo(col_).getDataChoices();
946 for(
const auto& choice : choices)
947 retVec.push_back(choice);
956 auto commentNode =
getNode(TableViewColumnInfo::COL_NAME_COMMENT);
957 std::string comment = commentNode.getValueAsString();
958 return comment !=
"" && comment != TableViewColumnInfo::DATATYPE_COMMENT_DEFAULT &&
959 comment != TableViewColumnInfo::DATATYPE_COMMENT_OLD_DEFAULT &&
960 comment != commentNode.getColumnInfo().getDefaultValue();
968 ? TableViewColumnInfo::DATATYPE_COMMENT_DEFAULT
993 if(returnLinkTableValue)
994 return linkColValue_;
996 return ConfigurationTree::DISCONNECTED_VALUE;
997 else if(row_ == TableView::INVALID &&
998 col_ == TableView::INVALID)
999 return (groupId_ ==
"") ? table_->
getTableName() : groupId_;
1000 else if(col_ == TableView::INVALID)
1001 return tableView_->getDataView()[row_][tableView_->
getColUID()];
1004 __SS__ <<
"Impossible Link." << __E__;
1010 else if(row_ != TableView::INVALID &&
1011 col_ != TableView::INVALID)
1012 return tableView_->getDataView()[row_][col_];
1013 else if(row_ == TableView::INVALID &&
1014 col_ == TableView::INVALID)
1018 return ConfigurationTree::ROOT_NAME;
1020 return (groupId_ ==
"") ? table_->
getTableName() : groupId_;
1022 else if(row_ == TableView::INVALID)
1024 __SS__ <<
"Malformed ConfigurationTree" << __E__;
1029 else if(col_ == TableView::INVALID)
1030 return tableView_->getDataView()[row_][tableView_->
getColUID()];
1033 __SS__ <<
"Impossible." << __E__;
1047 return tableView_->getDataView()[row_][tableView_->
getColUID()];
1050 __SS__ <<
"Can not get UID of node with type '" << getNodeType()
1051 <<
".' Node type must be '" << ConfigurationTree::NODE_TYPE_VALUE
1052 <<
"' or '" << ConfigurationTree::NODE_TYPE_UID_LINK <<
".'" << __E__;
1065 return tableView_->getColumnInfo(col_).getDataType();
1067 return TableViewColumnInfo::DATATYPE_STRING;
1080 if(
getValueType() == TableViewColumnInfo::TYPE_ON_OFF ||
1081 getValueType() == TableViewColumnInfo::TYPE_TRUE_FALSE ||
1084 TableViewColumnInfo::DATATYPE_BOOL_DEFAULT;
1086 else if(
getValueType() == TableViewColumnInfo::TYPE_COMMENT)
1087 return getValueAsString() == TableViewColumnInfo::DATATYPE_COMMENT_DEFAULT ||
1091 return getValueAsString() == TableViewColumnInfo::DATATYPE_STRING_DEFAULT ||
1110 __SS__ <<
"Can only get default value from a value node! "
1111 <<
"The node type is " << getNodeType() << __E__;
1119 if(
getValueType() == TableViewColumnInfo::TYPE_ON_OFF ||
1120 getValueType() == TableViewColumnInfo::TYPE_TRUE_FALSE ||
1122 return TableViewColumnInfo::DATATYPE_BOOL_DEFAULT;
1124 else if(
getValueType() == TableViewColumnInfo::TYPE_COMMENT)
1125 return TableViewColumnInfo::
1126 DATATYPE_COMMENT_DEFAULT;
1128 return TableViewColumnInfo::DATATYPE_STRING_DEFAULT;
1131 return TableViewColumnInfo::DATATYPE_NUMBER_DEFAULT;
1133 return TableViewColumnInfo::DATATYPE_TIME_DEFAULT;
1136 __SS__ <<
"Can only get default value from a value node! "
1137 <<
"The node type is " << getNodeType() << __E__;
1150 return tableView_->getColumnInfo(col_).getType();
1152 return ConfigurationTree::VALUE_TYPE_DISCONNECTED;
1154 return ConfigurationTree::VALUE_TYPE_NODE;
1163 return tableView_->getColumnInfo(col_);
1166 __SS__ <<
"Can only get column info from a value node! "
1167 <<
"The node type is " << getNodeType() << __E__;
1190 return linkBackRow_;
1204 return linkBackCol_;
1216 __SS__ <<
"Can only get link ID from a link! "
1217 <<
"The node type is " << getNodeType() << __E__;
1222 return childLinkIndex_;
1231 return tableView_->getColumnInfo(col_).getName();
1233 return linkColName_;
1236 __SS__ <<
"Can only get value name of a value node!" << __E__;
1247 const std::string& childPath,
1248 bool doNotThrowOnBrokenUIDLinks,
1249 const std::string& originalNodeString)
1251 __COUTS__(50) << tree.row_ <<
" " << tree.col_ << __E__;
1252 __COUTS__(51) <<
"childPath=" << childPath <<
" " << childPath.length() << __E__;
1253 if(childPath.length() <= 1)
1255 return tree.recursiveGetNode(
1256 childPath, doNotThrowOnBrokenUIDLinks, originalNodeString);
1270 bool doNotThrowOnBrokenUIDLinks)
const
1273 return recursiveGetNode(
1274 nodeString, doNotThrowOnBrokenUIDLinks,
"" );
1277 const std::string& nodeString,
1278 bool doNotThrowOnBrokenUIDLinks,
1279 const std::string& originalNodeString)
const
1281 __COUTS__(51) <<
"nodeString=" << nodeString <<
" len=" << nodeString.length()
1283 __COUTS__(52) <<
"doNotThrowOnBrokenUIDLinks=" << doNotThrowOnBrokenUIDLinks << __E__;
1286 if(nodeString.length() < 1)
1288 __SS__ <<
"Invalid empty node name! Looking for child node '" << nodeString
1289 <<
"' from node '" <<
getValue() <<
"'..." << __E__;
1296 size_t startingIndex = 0;
1297 while(startingIndex < nodeString.length() && nodeString[startingIndex] ==
'/')
1299 size_t endingIndex = nodeString.find(
'/', startingIndex);
1300 if(endingIndex == std::string::npos)
1301 endingIndex = nodeString.length();
1303 std::string nodeName = nodeString.substr(startingIndex, endingIndex - startingIndex);
1304 __COUTS__(51) <<
"nodeName=" << nodeName <<
" len=" << nodeName.length() << __E__;
1307 std::string childPath =
1308 (endingIndex >= nodeString.length() ?
"" : nodeString.substr(endingIndex));
1309 __COUTS__(51) <<
"childPath=" << childPath <<
" len=" << childPath.length()
1310 <<
" endingIndex=" << endingIndex
1311 <<
" nodeString.length()=" << nodeString.length() << __E__;
1317 __COUTS__(50) << row_ <<
" " << col_ <<
" " << groupId_ <<
" " << tableView_
1323 return recurse(configMgr_->
getNode(nodeName),
1325 doNotThrowOnBrokenUIDLinks,
1326 originalNodeString);
1328 else if(row_ == TableView::INVALID && col_ == TableView::INVALID)
1334 __SS__ <<
"Missing configView pointer! Likely attempting to access a "
1335 "child node through a disconnected link node."
1351 TableView::INVALID ,
1352 TableView::INVALID ,
1364 doNotThrowOnBrokenUIDLinks,
1365 originalNodeString);
1367 else if(row_ == TableView::INVALID)
1369 __SS__ <<
"Malformed ConfigurationTree" << __E__;
1374 else if(col_ == TableView::INVALID)
1379 __COUTS__(51) <<
"nodeName=" << nodeName <<
" " << nodeName.length() << __E__;
1389 __SS__ <<
"Missing configView pointer! Likely attempting to access a "
1390 "child node through a disconnected link node."
1397 unsigned int c = tableView_->
findCol(nodeName);
1398 std::pair<
unsigned int ,
unsigned int > linkPair;
1399 bool isGroupLink, isLink;
1400 if((isLink = tableView_->
getChildLink(c, isGroupLink, linkPair)) &&
1403 __COUTS__(50) <<
"nodeName=" << nodeName <<
" " << nodeName.length()
1413 tableView_->getDataView()[row_][linkPair.first]);
1414 childConfig->getView();
1416 if(doNotThrowOnBrokenUIDLinks)
1418 childConfig->getView().
findRow(
1420 tableView_->getDataView()[row_][linkPair.second]);
1426 <<
"Found disconnected node! (" << nodeName <<
":"
1427 << tableView_->getDataView()[row_][linkPair.first] <<
")"
1428 <<
" at entry with UID "
1429 << tableView_->getDataView()[row_][tableView_->
getColUID()]
1438 tableView_->getDataView()[row_][c],
1443 tableView_->getDataView()[row_][linkPair.first],
1446 tableView_->getDataView()[row_][linkPair.second],
1459 tableView_->getDataView()[row_][c],
1467 childConfig->getView().
findRow(
1469 tableView_->getDataView()[row_][linkPair.second])),
1471 doNotThrowOnBrokenUIDLinks,
1472 originalNodeString);
1476 __COUTS__(50) <<
"nodeName=" << nodeName <<
" " << nodeName.length()
1486 tableView_->getDataView()[row_][linkPair.first]);
1487 childConfig->getView();
1491 if(tableView_->getDataView()[row_][linkPair.first] !=
1492 TableViewColumnInfo::DATATYPE_LINK_DEFAULT)
1494 <<
"Found disconnected node! Failed link target "
1496 << nodeName <<
" to table:id="
1497 << tableView_->getDataView()[row_][linkPair.first] <<
":"
1498 << tableView_->getDataView()[row_][linkPair.second] << __E__;
1504 tableView_->getDataView()[row_][linkPair.second],
1507 tableView_->getDataView()[row_][c],
1512 tableView_->getDataView()[row_][linkPair.first],
1515 tableView_->getDataView()[row_][linkPair.second],
1526 ->getDataView()[row_][linkPair.second],
1529 tableView_->getDataView()[row_][c],
1538 doNotThrowOnBrokenUIDLinks,
1539 originalNodeString);
1543 __COUTS__(50) <<
"nodeName=" << nodeName <<
" " << nodeName.length()
1552 TableView::INVALID ,
1553 TableView::INVALID ,
1562 catch(std::runtime_error& e)
1564 __SS__ <<
"\n\nError occurred descending from node '" <<
getValue()
1565 <<
"' in table '" <<
getTableName() <<
"' looking for child '" << nodeName
1568 ss <<
"The original node search string was '" << originalNodeString <<
".'"
1570 ss <<
"--- Additional error detail: \n\n" << e.what() << __E__;
1577 __SS__ <<
"\n\nError occurred descending from node '" <<
getValue()
1578 <<
"' in table '" <<
getTableName() <<
"' looking for child '" << nodeName
1581 ss <<
"The original node search string was '" << originalNodeString <<
".'"
1587 catch(
const std::exception& e)
1589 ss <<
"Exception message: " << e.what();
1600 <<
"\n\nError occurred descending from node '" <<
getValue() <<
"' in table '"
1601 <<
getTableName() <<
"' looking for child '" << nodeName <<
"'\n\n"
1602 <<
"Invalid depth! getNode() called from a value point in the Configuration Tree."
1604 ss <<
"The original node search string was '" << originalNodeString <<
".'" << __E__;
1613 const std::string& nodeString)
const
1615 if(nodeString.length() < 1)
1630 if(!forcePrintout && time(0) - ConfigurationTree::LAST_NODE_DUMP_TIME < 3)
1632 __COUTS__(20) <<
"Blocking cascading node dumps... "
1633 "ConfigurationTree::LAST_NODE_DUMP_TIME = "
1634 << ConfigurationTree::LAST_NODE_DUMP_TIME << __E__;
1637 ConfigurationTree::LAST_NODE_DUMP_TIME = time(0);
1639 __SS__ << __E__ << __E__;
1641 ss <<
"Row=" << (int)row_ <<
", Col=" << (
int)col_ <<
", TablePointer=" << table_
1653 ss <<
"ConfigurationTree::nodeDump() start"
1654 "=====================================\nConfigurationTree::nodeDump():"
1661 <<
"Node dump initiated from node '" <<
getValueAsString() <<
"'..." << __E__;
1669 <<
"Node dump initiated from node '" <<
getValue() <<
"' in table '"
1684 <<
"Here is the list of possible children (count = " << children.size()
1686 for(
auto& child : children)
1687 ss <<
"\t\t" << child << __E__;
1690 ss <<
"\n\nHere is the culprit table printout:\n\n";
1691 tableView_->print(ss);
1697 ss <<
"Is link node." << __E__;
1698 ss <<
"disconnectedTargetName_ = " << disconnectedTargetName_
1699 <<
", disconnectedLinkID_ = " << disconnectedLinkID_ << __E__;
1703 <<
"Here is the list of active tables:" << __E__;
1704 for(
auto& table : tables)
1705 ss <<
"\t\t" << table.first << __E__;
1712 ss <<
"\n\nConfigurationTree::nodeDump() end ====================================="
1720 unsigned int backSteps)
const
1722 for(
unsigned int i = 0; i < backSteps; i++)
1723 nodeName = nodeName.substr(0, nodeName.find_last_of(
'/'));
1730 unsigned int forwardSteps)
const
1735 while(s < nodeName.length() && nodeName[s] ==
'/')
1738 for(
unsigned int i = 0; i < forwardSteps; i++)
1739 s = nodeName.find(
'/', s) + 1;
1741 return getNode(nodeName.substr(0, s));
1749 return (row_ != TableView::INVALID && col_ != TableView::INVALID);
1777 __SS__ <<
"\n\nError occurred testing link connection at node with value '"
1780 ss <<
"This is not a Link node! It is node type '" << getNodeType()
1781 <<
".' Only a Link node can be disconnected." << __E__;
1787 return !table_ || !tableView_;
1799 const std::string ConfigurationTree::NODE_TYPE_TABLE =
"TableNode";
1800 const std::string ConfigurationTree::NODE_TYPE_GROUP_LINK =
"GroupLinkNode";
1801 const std::string ConfigurationTree::NODE_TYPE_UID_LINK =
"UIDLinkNode";
1802 const std::string ConfigurationTree::NODE_TYPE_VALUE =
"ValueNode";
1803 const std::string ConfigurationTree::NODE_TYPE_UID =
"UIDNode";
1804 const std::string ConfigurationTree::NODE_TYPE_ROOT =
"RootNode";
1806 std::string ConfigurationTree::getNodeType(
void)
const
1809 return ConfigurationTree::NODE_TYPE_ROOT;
1810 if(isTableNode() && groupId_ !=
"")
1813 return ConfigurationTree::NODE_TYPE_TABLE;
1815 return ConfigurationTree::NODE_TYPE_GROUP_LINK;
1817 return ConfigurationTree::NODE_TYPE_UID_LINK;
1819 return ConfigurationTree::NODE_TYPE_VALUE;
1820 return ConfigurationTree::NODE_TYPE_UID;
1852 return (row_ != TableView::INVALID && col_ == TableView::INVALID);
1872 const std::vector<std::string /*uid*/>& recordList,
1873 const std::vector<std::string /*relative-path*/>& fieldAcceptList,
1874 const std::vector<std::string /*relative-path*/>& fieldRejectList,
1876 bool autoSelectFilterFields)
const
1879 if(!isRootNode() && !isTableNode())
1881 __SS__ <<
"Can only get getCommonFields from a root or table node! "
1882 <<
"The node type is " << getNodeType() << __E__;
1888 std::vector<ConfigurationTree::RecordField> fieldCandidateList;
1889 std::vector<int> fieldCount;
1933 if(!recordList.size() && tableView_)
1935 const std::vector<TableViewColumnInfo>& colInfo = tableView_->getColumnsInfo();
1937 for(
unsigned int col = 0; col < colInfo.size(); ++col)
1939 __COUTS__(11) <<
"Considering field " << colInfo[col].getName() << __E__;
1942 found = fieldAcceptList.size() ? false :
true;
1944 for(
const auto& fieldFilter : fieldAcceptList)
1956 for(
const auto& fieldFilter : fieldRejectList)
1967 __COUTS__(11) <<
"FOUND field " << colInfo[col].getName() << __E__;
1969 if(colInfo[col].isChildLink())
1972 <<
"isGroupLinkNode " << colInfo[col].getName() << __E__;
1976 std::pair<
unsigned int ,
unsigned int >
1986 tableView_->getColumnInfo(linkPair.first).getName(),
1988 &tableView_->getColumnInfo(linkPair.first)));
1989 fieldCount.push_back(-1);
1994 tableView_->getColumnInfo(linkPair.second).getName(),
1996 &tableView_->getColumnInfo(linkPair.second)));
1997 fieldCount.push_back(-1);
2004 colInfo[col].getName(),
2007 fieldCount.push_back(1);
2013 for(
unsigned int i = 0; i < recordList.size(); ++i)
2015 __COUTS__(11) <<
"Checking " << recordList[i] << __E__;
2018 node.recursiveGetCommonFields(fieldCandidateList,
2029 __COUT__ <<
"======================= check for count = " << (int)recordList.size()
2034 for(
unsigned int i = 0; i < fieldCandidateList.size(); ++i)
2036 __COUTS__(11) <<
"Checking " << fieldCandidateList[i].relativePath_
2037 << fieldCandidateList[i].columnName_ <<
" = " << fieldCount[i]
2039 if(recordList.size() != 0 && fieldCount[i] != -1 &&
2040 fieldCount[i] != (
int)recordList.size())
2042 __COUTS__(11) <<
"Erasing " << fieldCandidateList[i].relativePath_
2043 << fieldCandidateList[i].columnName_ << __E__;
2045 fieldCount.erase(fieldCount.begin() + i);
2046 fieldCandidateList.erase(fieldCandidateList.begin() + i);
2051 for(
unsigned int i = 0; i < fieldCandidateList.size(); ++i)
2052 __COUTS__(11) <<
"Pre-Final " << fieldCandidateList[i].relativePath_
2053 << fieldCandidateList[i].columnName_ << __E__;
2055 if(autoSelectFilterFields)
2059 std::set<std::pair<
unsigned int ,
unsigned int >>
2062 unsigned int priorityPenalty;
2063 for(
unsigned int i = 0; i < fieldCandidateList.size(); ++i)
2065 __COUTS__(11) <<
"Option [" << i <<
"] "
2066 << fieldCandidateList[i].relativePath_
2067 << fieldCandidateList[i].columnName_ <<
" : "
2068 << fieldCandidateList[i].columnInfo_->getType() <<
":"
2069 << fieldCandidateList[i].columnInfo_->getDataType() << __E__;
2071 priorityPenalty = std::count(fieldCandidateList[i].relativePath_.begin(),
2072 fieldCandidateList[i].relativePath_.end(),
2076 if(fieldCandidateList[i].columnInfo_->isBoolType() &&
2077 (fieldCandidateList[i].columnName_ ==
2078 TableViewColumnInfo::COL_NAME_STATUS ||
2079 fieldCandidateList[i].columnName_ ==
2080 TableViewColumnInfo::COL_NAME_ENABLED))
2082 priorityPenalty += 0;
2084 else if(fieldCandidateList[i].columnInfo_->isGroupID())
2086 priorityPenalty += 1;
2088 else if(fieldCandidateList[i].columnInfo_->isBoolType())
2090 priorityPenalty += 3;
2092 else if(fieldCandidateList[i].columnInfo_->getType() ==
2093 TableViewColumnInfo::TYPE_FIXED_CHOICE_DATA)
2095 priorityPenalty += 3;
2097 else if(fieldCandidateList[i].columnInfo_->getType() ==
2098 TableViewColumnInfo::TYPE_DATA)
2100 priorityPenalty += 10;
2104 fieldCandidateList[i].tableName_ =
2108 prioritySet.emplace(
2109 std::make_pair(priorityPenalty , i ));
2110 __COUTS__(11) <<
"Option [" << i <<
"] "
2111 << fieldCandidateList[i].relativePath_
2112 << fieldCandidateList[i].columnName_ <<
" : "
2113 << fieldCandidateList[i].columnInfo_->getType() <<
":"
2114 << fieldCandidateList[i].columnInfo_->getDataType()
2115 <<
"... priority = " << priorityPenalty << __E__;
2124 unsigned int cnt = 0;
2125 for(
const auto& priorityFieldIndex : prioritySet)
2129 << cnt <<
" marking "
2130 << fieldCandidateList[priorityFieldIndex.second].relativePath_
2131 << fieldCandidateList[priorityFieldIndex.second].columnName_
2133 fieldCandidateList[priorityFieldIndex.second].tableName_ =
2138 for(
unsigned int i = 0; i < fieldCandidateList.size(); ++i)
2140 if(fieldCandidateList[i].tableName_ ==
"")
2142 __COUTS__(11) <<
"Erasing " << fieldCandidateList[i].relativePath_
2143 << fieldCandidateList[i].columnName_ << __E__;
2144 fieldCandidateList.erase(fieldCandidateList.begin() + i);
2150 for(
unsigned int i = 0; i < fieldCandidateList.size(); ++i)
2151 __COUT__ <<
"Final " << fieldCandidateList[i].relativePath_
2152 << fieldCandidateList[i].columnName_ << __E__;
2154 return fieldCandidateList;
2164 const std::vector<std::string /*relative-path*/>& recordList,
2165 const std::string& fieldName,
2166 std::string* fieldGroupIDChildLinkIndex )
const
2168 if(fieldGroupIDChildLinkIndex)
2169 *fieldGroupIDChildLinkIndex =
"";
2174 __SS__ <<
"Can only get getCommonFields from a table node! "
2175 <<
"The node type is " << getNodeType() << __E__;
2181 std::set<std::string > uniqueValues;
2189 if(!recordList.size() && tableView_ && fieldGroupIDChildLinkIndex)
2192 tableView_->getColumnInfo(tableView_->
findCol(fieldName));
2199 for(
unsigned int i = 0; i < recordList.size(); ++i)
2219 if(i == 0 && fieldGroupIDChildLinkIndex)
2225 for(
auto& groupID : setOfGroupIDs)
2226 uniqueValues.emplace(groupID);
2233 return uniqueValues;
2239 void ConfigurationTree::recursiveGetCommonFields(
2240 std::vector<ConfigurationTree::RecordField>& fieldCandidateList,
2241 std::vector<int>& fieldCount,
2242 const std::vector<std::string /*relative-path*/>& fieldAcceptList,
2243 const std::vector<std::string /*relative-path*/>& fieldRejectList,
2245 const std::string& relativePathBase,
2246 bool inFirstRecord)
const
2279 for(
const auto& fieldNode : recordChildren)
2285 if(fieldNode.second.isValueNode() || fieldNode.second.isGroupLinkNode())
2288 if(fieldNode.second.isValueNode())
2290 if(fieldNode.second.getColumnInfo().getType() ==
2291 TableViewColumnInfo::TYPE_AUTHOR ||
2292 fieldNode.second.getColumnInfo().getType() ==
2293 TableViewColumnInfo::TYPE_TIMESTAMP)
2306 found = fieldAcceptList.size() ? false :
true;
2308 for(
const auto& fieldFilter : fieldAcceptList)
2309 if(fieldFilter.find(
'/') != std::string::npos)
2313 fieldFilter, relativePathBase + fieldNode.first))
2330 for(
const auto& fieldFilter : fieldRejectList)
2331 if(fieldFilter.find(
'/') != std::string::npos)
2335 fieldFilter, relativePathBase + fieldNode.first))
2354 if(fieldNode.second.isGroupLinkNode())
2360 std::pair<
unsigned int ,
unsigned int >
2364 tableView_->
findCol(fieldNode.first), isGroupLink, linkPair);
2371 tableView_->getColumnInfo(linkPair.first).getName(),
2373 &tableView_->getColumnInfo(linkPair.first)));
2374 fieldCount.push_back(1);
2379 tableView_->getColumnInfo(linkPair.second).getName(),
2381 &tableView_->getColumnInfo(linkPair.second)));
2382 fieldCount.push_back(1);
2391 &fieldNode.second.getColumnInfo()));
2392 fieldCount.push_back(1);
2400 for(j = 0; j < fieldCandidateList.size(); ++j)
2402 if((relativePathBase + fieldNode.first) ==
2403 (fieldCandidateList[j].relativePath_ +
2404 fieldCandidateList[j].columnName_))
2410 if(fieldNode.second.isGroupLinkNode() &&
2411 j + 1 < fieldCandidateList.size())
2412 ++fieldCount[j + 1];
2418 else if(fieldNode.second.isUIDLinkNode())
2427 fieldAcceptList.size() ? false :
true;
2428 for(
const auto& fieldFilter : fieldAcceptList)
2429 if(fieldFilter.find(
'/') != std::string::npos)
2433 fieldFilter, relativePathBase + fieldNode.first))
2450 for(
const auto& fieldFilter : fieldRejectList)
2451 if(fieldFilter.find(
'/') != std::string::npos)
2455 fieldFilter, relativePathBase + fieldNode.first))
2473 std::pair<
unsigned int ,
unsigned int >
2479 tableView_->
findCol(fieldNode.first), isGroupLink, linkPair);
2486 tableView_->getColumnInfo(linkPair.first).getName(),
2488 &tableView_->getColumnInfo(linkPair.first)));
2489 fieldCount.push_back(1);
2494 tableView_->getColumnInfo(linkPair.second).getName(),
2496 &tableView_->getColumnInfo(linkPair.second)));
2497 fieldCount.push_back(1);
2504 for(j = 0; j < fieldCandidateList.size() - 1; ++j)
2506 if((relativePathBase + fieldNode.first) ==
2507 (fieldCandidateList[j].relativePath_ +
2508 fieldCandidateList[j].columnName_))
2514 ++fieldCount[j + 1];
2521 if(depth > 0 && !fieldNode.second.isDisconnected())
2522 fieldNode.second.recursiveGetCommonFields(
2528 (relativePathBase + fieldNode.first) +
"/",
2541 std::vector<std::vector<std::pair<std::string, ConfigurationTree>>>
2543 std::map<std::string /*relative-path*/, std::string /*value*/> filterMap,
2544 bool onlyStatusTrue)
const
2546 std::vector<std::vector<std::pair<std::string, ConfigurationTree>>> retVector;
2550 bool filtering = filterMap.size();
2551 std::string fieldValue;
2553 bool createContainer;
2555 std::vector<std::vector<std::string>> childrenNamesByPriority =
2558 for(
auto& childNamesAtPriority : childrenNamesByPriority)
2560 createContainer =
true;
2562 for(
auto& childName : childNamesAtPriority)
2572 retVector.push_back(
2573 std::vector<std::pair<std::string, ConfigurationTree>>());
2574 createContainer =
false;
2577 retVector[retVector.size() - 1].push_back(
2578 std::pair<std::string, ConfigurationTree>(
2579 childName, this->
getNode(childName,
true)));
2591 const std::string& childName,
2592 std::map<std::string /*relative-path*/, std::string /*value*/> filterMap)
const
2598 for(
const auto& filterPair : filterMap)
2600 std::string filterPath = childName +
"/" + filterPair.first;
2601 __COUTV__(filterPath);
2607 std::vector<std::string> fieldValues;
2609 filterPair.second, fieldValues, std::set<char>({
','}) );
2611 __COUTV__(fieldValues.size());
2615 for(
const auto& fieldValue : fieldValues)
2629 bool groupIdFound =
false;
2632 for(
auto& groupID : setOfGroupIDs)
2634 __COUT__ <<
"\t\tGroupID Check: " << filterPair.first
2635 <<
" == " << fieldValue <<
" => "
2637 <<
" ??? " << groupID << __E__;
2643 __COUT__ <<
"Found match" << __E__;
2644 groupIdFound =
true;
2652 __COUT__ <<
"Found break match" << __E__;
2659 __COUT__ <<
"\t\tCheck: " << filterPair.first <<
" == " << fieldValue
2676 __SS__ <<
"Failed to access filter path '" << filterPath <<
"' - aborting."
2700 std::map<std::string /*relative-path*/, std::string /*value*/> filterMap,
2702 bool onlyStatusTrue)
const
2704 std::vector<std::pair<std::string, ConfigurationTree>> retVector;
2708 bool filtering = filterMap.size();
2710 std::string fieldValue;
2712 std::vector<std::string> childrenNames =
getChildrenNames(byPriority, onlyStatusTrue);
2714 for(
auto& childName : childrenNames)
2720 retVector.push_back(std::pair<std::string, ConfigurationTree>(
2721 childName, this->
getNode(childName,
true)));
2724 __COUTS__(2) <<
"Done w/Children of node: " <<
getValueAsString() << __E__;
2733 std::map<std::string /*relative-path*/, std::string /*value*/> filterMap,
2734 bool onlyStatusTrue)
const
2736 std::map<std::string, ConfigurationTree> retMap;
2738 bool filtering = filterMap.size();
2741 std::vector<std::string> childrenNames =
2743 for(
auto& childName : childrenNames)
2751 retMap.insert(std::pair<std::string, ConfigurationTree>(
2752 childName, this->
getNode(childName)));
2766 <<
".' Can only check the status of a UID/Record node!" << __E__;
2771 bool tmpStatus =
true;
2776 catch(
const std::runtime_error& e)
2785 bool ConfigurationTree::isStatusNode(
void)
const
2797 bool onlyStatusTrue)
const
2799 std::vector<std::vector<std::string >> retVector;
2804 <<
"' with null configuration view pointer!" << __E__;
2813 if(row_ == TableView::INVALID && col_ == TableView::INVALID)
2820 std::vector<std::vector<
unsigned int >> groupRowsByPriority =
2823 ? TableView::INVALID
2830 for(
const auto& priorityChildRowVector : groupRowsByPriority)
2832 retVector.push_back(std::vector<std::string /*child name*/>());
2833 for(
const auto& priorityChildRow : priorityChildRowVector)
2834 retVector[retVector.size() - 1].push_back(
2835 tableView_->getDataView()[priorityChildRow][tableView_->
getColUID()]);
2838 else if(row_ == TableView::INVALID)
2840 __SS__ <<
"Malformed ConfigurationTree" << __E__;
2845 else if(col_ == TableView::INVALID)
2850 for(
unsigned int c = 0; c < tableView_->getNumberOfColumns(); ++c)
2858 retVector.push_back(std::vector<std::string /*child name*/>());
2859 retVector[retVector.size() - 1].push_back(
2860 tableView_->getColumnInfo(c).getName());
2866 __SS__ <<
"\n\nError occurred looking for children of nodeName=" <<
getValueName()
2868 <<
"Invalid depth! getChildrenValues() called from a value point in the "
2869 "Configuration Tree."
2883 bool byPriority ,
bool onlyStatusTrue )
const
2885 std::vector<std::string > retVector;
2893 retVector.push_back(configPair.first);
2900 __SS__ <<
"Can not get children names of '" <<
getFieldName() <<
":"
2909 if(row_ == TableView::INVALID && col_ == TableView::INVALID)
2913 std::vector<
unsigned int > groupRows = tableView_->
getGroupRows(
2915 ? TableView::INVALID
2923 for(
const auto& groupRow : groupRows)
2924 retVector.push_back(
2925 tableView_->getDataView()[groupRow][tableView_->
getColUID()]);
2992 else if(row_ == TableView::INVALID)
2994 __SS__ <<
"Malformed ConfigurationTree" << __E__;
2999 else if(col_ == TableView::INVALID)
3004 for(
unsigned int c = 0; c < tableView_->getNumberOfColumns(); ++c)
3011 retVector.push_back(tableView_->getColumnInfo(c).getName());
3016 __SS__ <<
"\n\nError occurred looking for children of nodeName=" <<
getValueName()
3018 <<
"Invalid depth! getChildrenValues() called from a value point in the "
3019 "Configuration Tree."
3040 __SS__ <<
"Invalid node for get value." << __E__;
3044 std::string valueString =
3047 if(valueString.size() && valueString[0] ==
'/')
3054 __COUT__ <<
"Found a valid tree path in value!" << __E__;
3059 __SS__ <<
"Invalid tree path." << __E__;
3065 __SS__ <<
"Invalid value string '" << valueString
3066 <<
"' - must start with a '/' character." << __E__;
std::map< std::string, TableVersion > getActiveVersions(void) const
getActiveVersions
ConfigurationTree getNode(const std::string &nodeString, bool doNotThrowOnBrokenUIDLinks=false) const
"root/parent/parent/"
const TableBase * getTableByName(const std::string &configurationName) const
const unsigned int & getRow(void) const
getRow
const std::string & getValueDataType(void) const
bool isUIDNode(void) const
std::map< std::string, ConfigurationTree > getNodes(const std::string &nodeString) const
getNodes
const TableVersion & getTableVersion(void) const
getTableVersion
bool isDisconnected(void) const
const std::string & getAuthor(void) const
getAuthor
const std::string & getComment(void) const
getComment
std::vector< std::string > getChildrenNames(bool byPriority=false, bool onlyStatusTrue=false) const
bool isEnabled(void) const
same as status()
static const std::string NODE_TYPE_GROUP_TABLE
bool isValueNumberDataType(void) const
ConfigurationTree getNode(const std::string &nodeName, bool doNotThrowOnBrokenUIDLinks=false) const
navigating between nodes
const std::string & getTableName(void) const
getTableName
T getValueWithDefault(const T &defaultValue) const
const unsigned int & getFieldRow(void) const
std::map< std::string, ConfigurationTree > getChildrenMap(std::map< std::string, std::string > filterMap=std::map< std::string, std::string >(), bool onlyStatusTrue=false) const
std::string nodeDump(bool forcePrintout=false) const
used for debugging (when throwing exception)
const std::string & getValueName(void) const
const std::string & getValueAsString(bool returnLinkTableValue=false) const
const ConfigurationManager * getConfigurationManager(void) const
extracting information from node
const std::string & getChildLinkIndex(void) const
getChildLinkIndex
void print(const unsigned int &depth=-1, std::ostream &out=std::cout) const
bool isGroupIDNode(void) const
const std::string & getDisconnectedTableName(void) const
getDisconnectedTableName
bool isValueBoolType(void) const
std::vector< std::pair< std::string, ConfigurationTree > > getChildren(std::map< std::string, std::string > filterMap=std::map< std::string, std::string >(), bool byPriority=false, bool onlyStatusTrue=false) const
std::vector< std::string > getFixedChoices(void) const
bool hasComment(void) const
hasComment
bool isLinkNode(void) const
const std::string & getDefaultValue(void) const
const time_t & getTableCreationTime(void) const
getTableCreationTime
std::string getParentLinkIndex(void) const
getParentLinkIndex
const std::string & getUIDAsString(void) const
std::vector< ConfigurationTree::RecordField > getCommonFields(const std::vector< std::string > &recordList, const std::vector< std::string > &fieldAcceptList, const std::vector< std::string > &fieldRejectList, unsigned int depth=-1, bool autoSelectFilterFields=false) const
const unsigned int & getNodeRow(void) const
getNodeRow
std::set< std::string > getSetOfGroupIDs(void) const
bool isValueNode(void) const
const std::string & getFieldName(void) const
alias for getValueName
std::vector< std::vector< std::string > > getChildrenNamesByPriority(bool onlyStatusTrue=false) const
std::set< std::string > getUniqueValuesForField(const std::vector< std::string > &recordList, const std::string &fieldName, std::string *fieldGroupIDChildLinkIndex=0) const
const std::string & getValueType(void) const
bool passFilterMap(const std::string &childName, std::map< std::string, std::string > filterMap) const
~ConfigurationTree(void)
destructor
bool isGroupLinkNode(void) const
std::string getParentLinkID(void) const
getParentLinkID
const std::string & getFieldTableName(void) const
const unsigned int & getColumn(void) const
getColumn
const std::string & getDisconnectedLinkID(void) const
getDisconnectedLinkID
const std::string & getParentTableName(void) const
getParentTableName
bool isUIDLinkNode(void) const
const std::string & getParentRecordName(void) const
getParentRecordName
std::string getEscapedValue(void) const
const TableViewColumnInfo & getColumnInfo(void) const
bool isDefaultValue(void) const
boolean info
std::vector< std::vector< std::pair< std::string, ConfigurationTree > > > getChildrenByPriority(std::map< std::string, std::string > filterMap=std::map< std::string, std::string >(), bool onlyStatusTrue=false) const
const std::string & getParentLinkColumnName(void) const
getParentLinkColumnName
T getValue(void) const
defined in included .icc source
const unsigned int & getFieldColumn(void) const
const std::string & getTableName(void) const
Getters.
bool isChildLinkUID(void) const
static const std::string DATATYPE_NUMBER
std::string getChildLinkIndex(void) const
getChildLinkIndex
bool isGroupID(void) const
static const std::string TYPE_UID
NOTE: Do NOT put '-' in static const TYPEs because it will mess up javascript handling in the web gui...
const BitMapInfo & getBitMapInfo(void) const
uses dataChoices CSV fields if type is TYPE_BITMAP_DATA
bool isBoolType(void) const
TODO check if min and max values need a function called getallminmaxforgui or something like that for...
bool isNumberDataType(void) const
isNumberDataType
bool isChildLinkGroupID(void) const
const std::string & getDefaultValue(void) const
returns the configued default value value for this particular column
unsigned int findRow(unsigned int col, const T &value, unsigned int offsetRow=0, bool doNotThrow=false) const
< in included .icc source
std::string getEscapedValueAsString(unsigned int row, unsigned int col, bool convertEnvironmentVariables=true, bool quotesToDoubleQuotes=false) const
std::vector< std::vector< unsigned int > > getGroupRowsByPriority(const unsigned int groupIdCol, const std::string &groupID, bool onlyStatusTrue=false) const
T validateValueForColumn(const std::string &value, unsigned int col, bool doConvertEnvironmentVariables=true) const
< in included .icc source
unsigned int getColStatus(void) const
unsigned int getLinkGroupIDColumn(const std::string &childLinkIndex) const
bool getChildLink(const unsigned int &col, bool &isGroup, std::pair< unsigned int, unsigned int > &linkPair) const
std::string getValueAsString(unsigned int row, unsigned int col, bool convertEnvironmentVariables=true) const
std::vector< unsigned int > getGroupRows(const unsigned int groupIdCol, const std::string &groupID, bool onlyStatusTrue=false, bool orderedByPriority=false) const
std::set< std::string > getSetOfGroupIDs(const std::string &childLinkIndex, unsigned int row=-1) const
void getValue(T &value, unsigned int row, unsigned int col, bool doConvertEnvironmentVariables=true) const
< in included .icc source
unsigned int getColUID(void) const
unsigned int findCol(const std::string &name) const
unsigned int findRowInGroup(unsigned int col, const T &value, const std::string &groupId, const std::string &childLinkIndex, unsigned int offsetRow=0) const
< in included .icc source
defines used also by OtsConfigurationWizardSupervisor
extracting information from a list of records
static void getVectorFromString(const std::string &inputString, std::vector< std::string > &listToReturn, const std::set< char > &delimiter={',', '|', '&'}, const std::set< char > &whitespace={' ', '\t', '\n', '\r'}, std::vector< char > *listOfDelimiters=0, bool decodeURIComponents=false)
static std::string setToString(const std::set< T > &setToReturn, const std::string &delimeter=", ")
setToString ~
static std::string vectorToString(const std::vector< T > &setToReturn, const std::string &delimeter=", ")
vectorToString ~
static std::string mapToString(const std::map< std::string, T > &mapToReturn, const std::string &primaryDelimeter=", ", const std::string &secondaryDelimeter=": ")
static bool wildCardMatch(const std::string &needle, const std::string &haystack, unsigned int *priorityIndex=0)
static std::string decodeURIComponent(const std::string &data)
static std::string stackTrace(void)