2
3
4
5
6
7
8
9
10
11
12
13
14
15
17
18
19
20
30#include "core/clockwerkerrors.h"
38 enum graph_tree_types_e :
unsigned char {
48 const std::string DELIMETER =
".";
49 const std::string DEFAULT_NAME =
"_";
123 int name(
const std::string &new_name);
143 std::vector<std::string>
search(
const std::string &address);
155 void dump(
bool recursive=
false);
169 virtual std::vector<std::string> header_info()
const {
return std::vector<std::string>();}
182 void lock(
bool recursive =
true);
186 void unlock(
bool recursive =
true);
210 void findMatches(
const std::vector<std::string> &subaddresses,
const unsigned int &num_subaddresses,
211 unsigned int index,
bool match_found, std::vector<
GraphTreeObject*> &matches);
237 std::string
_name = DEFAULT_NAME;
Base class for object organization.
Definition GraphTreeObject.h:87
unsigned int nChildren()
Getters for number of children and descendants.
Definition GraphTreeObject.h:118
void lock(bool recursive=true)
Function to lock the graph tree object and its children to changes.
Definition GraphTreeObject.cpp:329
void recalculateRank()
Function to recursively re-calculate the rank of a given node on the tree.
Definition GraphTreeObject.cpp:263
int rank()
Getter for the object rank.
Definition GraphTreeObject.h:126
virtual ~GraphTreeObject()
Destructor.
Definition GraphTreeObject.h:93
int addChild(GraphTreeObject *child)
Function to add a child to the graph tree object.
Definition GraphTreeObject.cpp:110
bool loggable()
Getter for object logability flag – note no setter because should only be set by this or a derived cl...
Definition GraphTreeObject.h:134
uint8_t _rank
Rank for how far down on the graph tree the object is – starts at zero and maxes out at 256 via varia...
Definition GraphTreeObject.h:248
void recurseGraphNodeInfo(unsigned int counter)
Function to recurse through graph tree and print all node info.
Definition GraphTreeObject.cpp:298
std::vector< GraphTreeObject * > searchNodes(const std::string &address)
Function to search through the graph tree by string address.
Definition GraphTreeObject.cpp:200
uint8_t _num_children
Number of direct children of the tree (not including the tree itself)
Definition GraphTreeObject.h:244
GraphTreeObject * _parent
Pointer to the object's parent – should be null if the object is the root. Is set to null by default.
Definition GraphTreeObject.h:230
virtual int header(void *logger)
Function to pass headers for this object to the logger.
Definition GraphTreeObject.h:167
int parent(GraphTreeObject &new_parent)
Function to assign the node's parent via reference.
Definition GraphTreeObject.cpp:62
void dump(bool recursive=false)
Function to dump the graph node, optionally including descendents.
Definition GraphTreeObject.cpp:277
std::string _name
String name for object.
Definition GraphTreeObject.h:237
bool _loggable
Variable to indicate whether the selected object is loggable. Set to false by default.
Definition GraphTreeObject.h:257
std::vector< std::string > decomposeAddress(std::string address)
Function to decompose a string into a series of substrings via indexing.
Definition GraphTreeObject.cpp:142
uint16_t _num_descendants
Total number of descendants (includes children of children) of the tree, again not including the tree...
Definition GraphTreeObject.h:241
GraphTreeObject * parent()
Functions to get object's parent/children.
Definition GraphTreeObject.h:96
virtual int type()
Function to indicate type – -1 by default unless implemented downstream.
Definition GraphTreeObject.h:130
std::vector< GraphTreeObject * > _children
Pointers to the object's children – automatically set to an empty vector, and can be increased to any...
Definition GraphTreeObject.h:234
std::string name() const
Getter and setter for object name.
Definition GraphTreeObject.h:122
int parent(GraphTreeObject *new_parent)
Function to assign the node's parent via pointer.
Definition GraphTreeObject.cpp:66
virtual int log(void *logger)
Function to log data to a logger.
Definition GraphTreeObject.h:178
std::string address()
Getter for object's string address.
Definition GraphTreeObject.cpp:52
void findMatches(const std::vector< std::string > &subaddresses, const unsigned int &num_subaddresses, unsigned int index, bool match_found, std::vector< GraphTreeObject * > &matches)
Function to find all addresses mathcing the set of substrings @parem subaddresses A vector of subaddr...
Definition GraphTreeObject.cpp:166
int removeChild(GraphTreeObject *child)
Function to remove a child from the graph node's children.
Definition GraphTreeObject.cpp:126
std::vector< std::string > search(const std::string &address)
Function to search through the graph tree by string address.
Definition GraphTreeObject.cpp:215
void findLoggable(std::vector< GraphTreeObject * > &matches)
Function to find all loggable parameters in this node and its children.
Definition GraphTreeObject.cpp:315
bool _locked
Variable to lock the graph tree object and prevent structural updates.
Definition GraphTreeObject.h:254
GraphTreeObject(const std::string &name="")
Constructor with name for graph tree object.
Definition GraphTreeObject.cpp:24
GraphTreeObject * getByAddress(const std::string &address)
Function to get an object from the graph tree by string address.
Definition GraphTreeObject.cpp:227
uint8_t _graph_tree_type
Variable to store graph tree object type.
Definition GraphTreeObject.h:251
void unlock(bool recursive=true)
Function to unlock the graph tree and its children for changes.
Definition GraphTreeObject.cpp:339
void recalculateDescendants()
Function to recursively re-calculate the number of descendants of a given node on the tree.
Definition GraphTreeObject.cpp:244
bool locked()
Function to return whether graph tree object is locked.
Definition GraphTreeObject.h:189
void graphNodeInfo()
Function to return all info associated with a given graph node.
Definition GraphTreeObject.cpp:286
#define WARN_NOT_LOGGABLE
Definition clockwerkerrors.h:76