tdaq-develop-2025-02-12
ots::ConfigurationTree Class Reference

Classes

struct  BitMap
 
struct  RecordField
 extracting information from a list of records More...
 

Public Member Functions

 ConfigurationTree ()
 
 ConfigurationTree (const ConfigurationManager *const &configMgr, const TableBase *const &table)
 
 ~ConfigurationTree (void)
 destructor
 
 ConfigurationTree (ConfigurationTree const &a)=default
 
ConfigurationTreeoperator= (const ConfigurationTree &a)
 
template<class T >
void getValue (T &value) const
 
void getValue (std::string &value) const
 
void getValueAsBitMap (ConfigurationTree::BitMap &value) const
 
template<class T >
getValue (void) const
 defined in included .icc source More...
 
template<class T >
getValueWithDefault (const T &defaultValue) const
 
std::string getValue (void) const
 
std::string getValueWithDefault (const std::string &defaultValue) const
 
ConfigurationTree::BitMap getValueAsBitMap (void) const
 
ConfigurationTree getNode (const std::string &nodeName, bool doNotThrowOnBrokenUIDLinks=false) const
 navigating between nodes More...
 
std::map< std::string, ConfigurationTreegetNodes (const std::string &nodeString) const
 getNodes
 
ConfigurationTree getBackNode (std::string nodeName, unsigned int backSteps=1) const
 
ConfigurationTree getForwardNode (std::string nodeName, unsigned int forwardSteps=1) const
 
const ConfigurationManagergetConfigurationManager (void) const
 extracting information from node
 
const std::string & getTableName (void) const
 getTableName
 
const std::string & getParentTableName (void) const
 getParentTableName
 
const std::string & getFieldTableName (void) const
 
const TableVersiongetTableVersion (void) const
 getTableVersion
 
const time_t & getTableCreationTime (void) const
 getTableCreationTime
 
std::vector< std::vector< std::string > > getChildrenNamesByPriority (bool onlyStatusTrue=false) const
 
std::vector< std::string > getChildrenNames (bool byPriority=false, bool onlyStatusTrue=false) const
 
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
 
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::map< std::string, ConfigurationTreegetChildrenMap (std::map< std::string, std::string > filterMap=std::map< std::string, std::string >(), bool onlyStatusTrue=false) const
 
bool passFilterMap (const std::string &childName, std::map< std::string, std::string > filterMap) const
 
std::string getEscapedValue (void) const
 
const std::string & getValueAsString (bool returnLinkTableValue=false) const
 
const std::string & getUIDAsString (void) const
 
const std::string & getComment (void) const
 getComment
 
const std::string & getAuthor (void) const
 getAuthor
 
const std::string & getValueDataType (void) const
 
const std::string & getValueType (void) const
 
const std::string & getValueName (void) const
 
const std::string & getDefaultValue (void) const
 
const std::string & getFieldName (void) const
 alias for getValueName
 
std::string getNodeType (void) const
 
const unsigned int & getNodeRow (void) const
 getNodeRow
 
const std::string & getDisconnectedTableName (void) const
 getDisconnectedTableName
 
const std::string & getDisconnectedLinkID (void) const
 getDisconnectedLinkID
 
const std::string & getChildLinkIndex (void) const
 getChildLinkIndex
 
std::vector< std::string > getFixedChoices (void) const
 
std::set< std::string > getSetOfGroupIDs (void) const
 
bool isDefaultValue (void) const
 boolean info More...
 
bool isRootNode (void) const
 
bool isTableNode (void) const
 
bool isValueNode (void) const
 
bool isValueBoolType (void) const
 
bool isValueNumberDataType (void) const
 
bool isDisconnected (void) const
 
bool isLinkNode (void) const
 
bool isGroupLinkNode (void) const
 
bool isUIDLinkNode (void) const
 
bool isGroupIDNode (void) const
 
bool isUIDNode (void) const
 
bool isStatusNode (void) const
 
bool isEnabled (void) const
 same as status()
 
bool status (void) const
 same as isEnabled()
 
void print (const unsigned int &depth=-1, std::ostream &out=std::cout) const
 
std::string nodeDump (void) const
 used for debugging (when throwing exception) More...
 

Static Public Attributes

static const std::string DISCONNECTED_VALUE = "X"
 
static const std::string VALUE_TYPE_DISCONNECTED = "Disconnected"
 
static const std::string VALUE_TYPE_NODE = "Node"
 
static const std::string NODE_TYPE_GROUP_TABLE = "GroupTableNode"
 
static const std::string NODE_TYPE_TABLE = "TableNode"
 
static const std::string NODE_TYPE_GROUP_LINK = "GroupLinkNode"
 
static const std::string NODE_TYPE_UID_LINK = "UIDLinkNode"
 
static const std::string NODE_TYPE_VALUE = "ValueNode"
 
static const std::string NODE_TYPE_UID = "UIDNode"
 
static const std::string NODE_TYPE_ROOT = "RootNode"
 
static const std::string ROOT_NAME = "/"
 

Protected Member Functions

const unsigned int & getRow (void) const
 getRow
 
const unsigned int & getColumn (void) const
 getColumn
 
const unsigned int & getFieldRow (void) const
 
const unsigned int & getFieldColumn (void) const
 
const TableViewColumnInfogetColumnInfo (void) const
 
std::vector< ConfigurationTree::RecordFieldgetCommonFields (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
 
std::set< std::string > getUniqueValuesForField (const std::vector< std::string > &recordList, const std::string &fieldName, std::string *fieldGroupIDChildLinkIndex=0) const
 

Friends

class ConfigurationGUISupervisor
 
class Iterator
 
class ARTDAQTableBase
 
std::ostream & operator<< (std::ostream &out, const ConfigurationTree &t)
 make stream output easy
 

Detailed Description

Definition at line 17 of file ConfigurationTree.h.

Constructor & Destructor Documentation

◆ ConfigurationTree() [1/2]

ConfigurationTree::ConfigurationTree ( )

Note: due to const members, implicit copy constructor exists, but NOT assignment operator= ... so ConfigurationTree t = mytree.GetNode(nodeString); //OK ... or ConfigurationTree t(mytree.GetNode(nodeString)); //OK ... but mytree = mytree.GetNode(nodeString); //does NOT work

Definition at line 20 of file ConfigurationTree.cc.

◆ ConfigurationTree() [2/2]

ConfigurationTree::ConfigurationTree ( const ConfigurationManager *const &  configMgr,
const TableBase *const &  table 
)

ConfigurationTree(const ConfigurationTree& a) : configMgr_ (a.configMgr_), table_ (a.table_), groupId_ (a.groupId_), linkColName_ (a.linkColName_), disconnectedTargetName_ (a.disconnectedTargetName_), childLinkIndex_ (a.childLinkIndex_), row_ (a.row_), col_ (a.col_), tableView_ (a.tableView_) { COUT << std::endl; //return *this; }

Definition at line 42 of file ConfigurationTree.cc.

Member Function Documentation

◆ getChildren()

std::vector< std::pair< std::string, ConfigurationTree > > ConfigurationTree::getChildren ( std::map< std::string, std::string >  filterMap = std::map<std::string , std::string >(),
bool  byPriority = false,
bool  onlyStatusTrue = false 
) const

getChildren returns them in order encountered in the table if filterMap criteria, then rejects any that do not meet all criteria filterMap-value can be comma-separated for OR of multiple values

Note: filterMap is handled special for groupID fields matches are considered after parsing | for set of groupIDs

Definition at line 2411 of file ConfigurationTree.cc.

◆ getChildrenByPriority()

std::vector< std::vector< std::pair< std::string, ConfigurationTree > > > ConfigurationTree::getChildrenByPriority ( std::map< std::string, std::string >  filterMap = std::map<std::string , std::string >(),
bool  onlyStatusTrue = false 
) const

getChildrenByPriority returns them in order encountered in the table if filterMap criteria, then rejects any that do not meet all criteria

value can be comma-separated for OR of multiple values

Definition at line 2254 of file ConfigurationTree.cc.

◆ getChildrenMap()

std::map< std::string, ConfigurationTree > ConfigurationTree::getChildrenMap ( std::map< std::string, std::string >  filterMap = std::map<std::string , std::string >(),
bool  onlyStatusTrue = false 
) const

getChildrenMap does not return them in order encountered in the table, instead, in alphabetical order of map

Definition at line 2443 of file ConfigurationTree.cc.

◆ getChildrenNames()

std::vector< std::string > ConfigurationTree::getChildrenNames ( bool  byPriority = false,
bool  onlyStatusTrue = false 
) const

getChildrenNames returns them in order encountered in the table

Definition at line 2593 of file ConfigurationTree.cc.

◆ getChildrenNamesByPriority()

std::vector< std::vector< std::string > > ConfigurationTree::getChildrenNamesByPriority ( bool  onlyStatusTrue = false) const

getChildrenNamesByPriority returns them in priority order encountered in the table

Definition at line 2507 of file ConfigurationTree.cc.

◆ getColumnInfo()

const TableViewColumnInfo & ConfigurationTree::getColumnInfo ( void  ) const
protected

getColumnInfo only sensible for value node

Definition at line 883 of file ConfigurationTree.cc.

◆ getCommonFields()

std::vector< ConfigurationTree::RecordField > ConfigurationTree::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
protected

getCommonFields wrapper for ...recursiveGetCommonFields

returns common fields in order encountered including through UID links depending on depth specified

Field := {Table, UID, Column Name, Relative Path, TableViewColumnInfo}

if fieldAcceptList or fieldRejectList are not empty, then reject any that are not in field accept filter list and reject any that are in field reject filter list

will only go to specified depth looking for fields (careful to prevent infinite loops in tree navigation)

Definition at line 1575 of file ConfigurationTree.cc.

◆ getDefaultValue()

const std::string & ConfigurationTree::getDefaultValue ( void  ) const

getDefaultValue returns default value if is value node TODO: should a function to get if it is min and max value be included here??

Definition at line 829 of file ConfigurationTree.cc.

◆ getEscapedValue()

std::string ConfigurationTree::getEscapedValue ( void  ) const

getEscapedValue Only works if a value node, other exception thrown

Definition at line 437 of file ConfigurationTree.cc.

◆ getFieldColumn()

const unsigned int & ConfigurationTree::getFieldColumn ( void  ) const
protected

getFieldColumn return field's column (different handling for value vs. link node)

Definition at line 922 of file ConfigurationTree.cc.

◆ getFieldRow()

const unsigned int & ConfigurationTree::getFieldRow ( void  ) const
protected

getFieldRow return field's row (different handling for value vs. link node)

Definition at line 908 of file ConfigurationTree.cc.

◆ getFieldTableName()

const std::string & ConfigurationTree::getFieldTableName ( void  ) const

getFieldTableName returns the configuration name for the node's field. Note: for link nodes versus value nodes this has different functionality than getTableName()

Definition at line 518 of file ConfigurationTree.cc.

◆ getFixedChoices()

std::vector< std::string > ConfigurationTree::getFixedChoices ( void  ) const

getFixedChoices returns vector of default + data choices Used as choices for tree-view, for example.

Definition at line 620 of file ConfigurationTree.cc.

◆ getNode()

ConfigurationTree ConfigurationTree::getNode ( const std::string &  nodeString,
bool  doNotThrowOnBrokenUIDLinks = false 
) const

navigating between nodes

getNode Connected to recursiveGetNode()

nodeString can be a multi-part path using / delimiter use: getNode(/uid/col) or getNode(uid)->getNode(col)

if doNotThrowOnBrokenUIDLinks then catch exceptions on UID links and call disconnected

Definition at line 994 of file ConfigurationTree.cc.

◆ getSetOfGroupIDs()

std::set< std::string > ConfigurationTree::getSetOfGroupIDs ( void  ) const

getSetOfGroupIDs returns set of group IDs if groupID value node

Definition at line 601 of file ConfigurationTree.cc.

◆ getUIDAsString()

const std::string & ConfigurationTree::getUIDAsString ( void  ) const

getUIDAsString returns UID associated with current value node or UID-Link node

Definition at line 768 of file ConfigurationTree.cc.

◆ getUniqueValuesForField()

std::set< std::string > ConfigurationTree::getUniqueValuesForField ( const std::vector< std::string > &  recordList,
const std::string &  fieldName,
std::string *  fieldGroupIDChildLinkIndex = 0 
) const
protected

getUniqueValuesForField

returns sorted unique values for the specified records and field Note: treat GroupIDs special, parse the | out of the value to get the distinct values.

Definition at line 1875 of file ConfigurationTree.cc.

◆ getValue() [1/4]

void ConfigurationTree::getValue ( std::string &  value) const

special version of getValue for string type Note: necessary because types of std::basic_string<char> cause compiler problems if no string specific function

getValue (only std::string value) special version of getValue for string type Note: necessary because types of std::basic_string<char> cause compiler problems if no string specific function

Definition at line 198 of file ConfigurationTree.cc.

◆ getValue() [2/4]

template<class T >
void ots::ConfigurationTree::getValue ( T &  value) const

Methods getValue (not std::string value) throw exception unless it value node NOTE: can not overload functions based on return type, so T& passed as value defined in included .icc source

◆ getValue() [3/4]

template<class T >
T ots::ConfigurationTree::getValue ( void  ) const

defined in included .icc source

getValue (not std::string value) throw exception unless it value node NOTE: can not overload functions based on return type, so calls function with T& passed as value

◆ getValue() [4/4]

std::string ConfigurationTree::getValue ( void  ) const

special version of getValue for string type Note: necessary because types of std::basic_string<char> cause compiler problems if no string specific function

getValue Only std::string value will work. If this is a value node, and not type string, configView->getValue should throw exception.

NOTE: getValueAsString() method should be preferred if getting the Link UID because when disconnected will return "X". getValue() would return the column name of the link when disconnected. special version of getValue for string type Note: if called without template, necessary because types of std::basic_string<char> cause compiler problems if no string specific function

Definition at line 274 of file ConfigurationTree.cc.

◆ getValueAsBitMap() [1/2]

void ConfigurationTree::getValueAsBitMap ( ConfigurationTree::BitMap bitmap) const

getValue (only ConfigurationTree::BitMap value) special version of getValue for string type Note: necessary because types of std::basic_string<char> cause compiler problems if no string specific function

Definition at line 306 of file ConfigurationTree.cc.

◆ getValueAsBitMap() [2/2]

ConfigurationTree::BitMap ConfigurationTree::getValueAsBitMap ( void  ) const

getValue

special version of getValue for ConfigurationTree::BitMap type

Definition at line 427 of file ConfigurationTree.cc.

◆ getValueAsString()

const std::string & ConfigurationTree::getValueAsString ( bool  returnLinkTableValue = false) const

getValueAsString NOTE: getValueAsString() method should be preferred if getting the Link UID because when disconnected will return "X". getValue() would return the column name of the link when disconnected.

returnLinkTableValue returns the value in the source table as though link was not followed to destination table.

Definition at line 711 of file ConfigurationTree.cc.

◆ getValueDataType()

const std::string & ConfigurationTree::getValueDataType ( void  ) const

getValueDataType e.g. used to determine if node is type NUMBER

Definition at line 786 of file ConfigurationTree.cc.

◆ getValueName()

const std::string & ConfigurationTree::getValueName ( void  ) const

getValueName e.g. used to determine column name of value node

Definition at line 951 of file ConfigurationTree.cc.

◆ getValueType()

const std::string & ConfigurationTree::getValueType ( void  ) const

getValueType e.g. used to determine if node is type TYPE_DATA, TYPE_ON_OFF, etc.

Definition at line 870 of file ConfigurationTree.cc.

◆ getValueWithDefault() [1/2]

std::string ConfigurationTree::getValueWithDefault ( const std::string &  defaultValue) const

getValueWithDefault Only std::string value will work. If this is a value node, and not type string, configView->getValue should throw exception.

NOTE: getValueAsString() method should be preferred if getting the Link UID because when disconnected will return "X". getValue() would return the column name of the link when disconnected. special version of getValue for string type Note: if called without template, necessary because types of std::basic_string<char> cause compiler problems if no string specific function

Definition at line 293 of file ConfigurationTree.cc.

◆ getValueWithDefault() [2/2]

template<class T >
T ots::ConfigurationTree::getValueWithDefault ( const T &  defaultValue) const

defined in included .icc source

◆ isDefaultValue()

bool ConfigurationTree::isDefaultValue ( void  ) const

boolean info

isDefaultValue returns true if is a value node and value is the default for the type

Definition at line 797 of file ConfigurationTree.cc.

◆ isDisconnected()

bool ConfigurationTree::isDisconnected ( void  ) const

isDisconnected if true, then this is a disconnected node, i.e. there is a configuration link missing (this is possible when the configuration is loaded in stages and the complete tree may not be available, yet)

Definition at line 1477 of file ConfigurationTree.cc.

◆ isGroupIDNode()

bool ConfigurationTree::isGroupIDNode ( void  ) const

isGroupIDNode if true, then this is a Group ID node

Definition at line 1546 of file ConfigurationTree.cc.

◆ isGroupLinkNode()

bool ConfigurationTree::isGroupLinkNode ( void  ) const

isGroupLinkNode if true, then this is a group link node

Definition at line 1530 of file ConfigurationTree.cc.

◆ isLinkNode()

bool ConfigurationTree::isLinkNode ( void  ) const

isLinkNode if true, then this is a link node

Definition at line 1497 of file ConfigurationTree.cc.

◆ isUIDLinkNode()

bool ConfigurationTree::isUIDLinkNode ( void  ) const

isUIDLinkNode if true, then this is a uid link node

Definition at line 1538 of file ConfigurationTree.cc.

◆ isUIDNode()

bool ConfigurationTree::isUIDNode ( void  ) const

isUIDNode if true, then this is a uid node

Definition at line 1554 of file ConfigurationTree.cc.

◆ isValueBoolType()

bool ConfigurationTree::isValueBoolType ( void  ) const

isValueBoolType if true, then this is a leaf node with BOOL type

Definition at line 1459 of file ConfigurationTree.cc.

◆ isValueNode()

bool ConfigurationTree::isValueNode ( void  ) const

isValueNode if true, then this is a leaf node, i.e. there can be no children, only a value

Definition at line 1451 of file ConfigurationTree.cc.

◆ isValueNumberDataType()

bool ConfigurationTree::isValueNumberDataType ( void  ) const

isValueNumberDataType if true, then this is a leaf node with NUMBER data type

Definition at line 1467 of file ConfigurationTree.cc.

◆ nodeDump()

std::string ConfigurationTree::nodeDump ( void  ) const

used for debugging (when throwing exception)

nodeDump Useful for debugging a node failure, like when throwing an exception

Definition at line 1355 of file ConfigurationTree.cc.

◆ passFilterMap()

bool ConfigurationTree::passFilterMap ( const std::string &  childName,
std::map< std::string, std::string >  filterMap 
) const

passFilterMap returns true if childName meets all critera

Definition at line 2302 of file ConfigurationTree.cc.

◆ print()

void ConfigurationTree::print ( const unsigned int &  depth = -1,
std::ostream &  out = std::cout 
) const

print print out tree from this node for desired depth depth of 0 means print out only this node's value depth of 1 means include this node's children's values, etc.. depth of -1 means print full tree

Definition at line 131 of file ConfigurationTree.cc.

Member Data Documentation

◆ NODE_TYPE_GROUP_TABLE

const std::string ConfigurationTree::NODE_TYPE_GROUP_TABLE = "GroupTableNode"
static

getNodeType return node type as string

Definition at line 113 of file ConfigurationTree.h.


The documentation for this class was generated from the following files: