The TreeNode struct the node that will occupy trees.
More...
#include <Tree.h>
|
|
typedef std::vector< TreeNode * > | TNvector |
| | TNvector typedef of std::vector<TreeNode*>
|
| |
|
|
Item | _data |
| | _data the item inside the node
|
| |
|
TNvector | _child |
| | _child a vector of children whose parent is this node
|
| |
template<typename Item>
struct TreeNode< Item >
The TreeNode struct the node that will occupy trees.
TreeNode Constructor.
- Parameters
-
| data | item, by default it is the Default Constructor for the Item Type |
| children | the children, by default it is any empty vector |
template<typename Item>
| void TreeNode< Item >::addChild |
( |
const Item & |
data | ) |
|
|
inline |
addChild adds a child to the vector
- Parameters
-
children returns a reference to the children vector
- Returns
- vector reference
children returns a non reference vector
- Returns
- non reference vector
data returns a reference to the item
- Returns
- item reference
data returns a non reference item
- Returns
- non reference item
isLeaf checks if the node is a leaf, i.e. has no children
- Returns
- True for is a Leaf, False for is not a leaf
setChildren changes the children
- Parameters
-
| children | the new children NOTE: Does not clean up any dynamic items it may hold. |
template<typename Item>
| void TreeNode< Item >::setData |
( |
const Item & |
data | ) |
|
|
inline |
setData changes the item
- Parameters
-
template<typename Item>
| std::ostream& operator<< |
( |
std::ostream & |
out, |
|
|
const TreeNode< Item > & |
T |
|
) |
| |
|
friend |
operator << insertion
- Parameters
-
- Returns
- the output stream
The documentation for this struct was generated from the following file: