![]() |
graph 6.0.0
Graph: generic attributed relational graphs
|
#include <graph/tree/base.h>

Public Types | |
| typedef std::list< BaseTree * >::iterator | iterator |
| typedef std::list< BaseTree * >::const_iterator | const_iterator |
| typedef std::list< BaseTree * >::reverse_iterator | reverse_iterator |
| typedef std::list< BaseTree * >::const_reverse_iterator | const_reverse_iterator |
Public Member Functions | |
| BaseTree (bool allowsChildren=true) | |
| Constructor. | |
| virtual | ~BaseTree () |
| const std::list< BaseTree * > & | children () const |
| bool | getAllowsChildren () const |
| Returns true if the receiver allows children. | |
| BaseTree * | getChildAt (unsigned childIndex) const |
Returns the child BaseTree pointer at index childIndex. | |
| int | getIndex (BaseTree *node) const |
Returns the index of node in the receivers children. | |
| BaseTree * | getParent () const |
| Returns the parent BaseTree of the receiver. | |
| BaseTree * | getTopParent () |
| Returns the top-level parent BaseTree of the receiver. | |
| const BaseTree * | getTopParent () const |
| Returns the top-level parent of the receiver (const version) | |
| bool | isLeaf () const |
| Returns true if the receiver is a leaf (terminal node) | |
| void | insert (BaseTree *child, int index=-1) |
Adds child to the receiver at index (default: end) | |
| void | remove (unsigned index) |
Removes the child at index index from the receiver. | |
| void | remove (BaseTree *node) |
Removes node from the receiver. | |
| void | removeFromParent () |
| Removes the receiver from its parent. | |
| void | setParent (BaseTree *newParent) |
Sets the parent of the receiver to newParent. | |
| void | clear () |
| Deletes all children from the tree. | |
List functions | |
| virtual size_t | size () const __attribute__((__deprecated__("use childrenSize() for the number of children"))) |
| deprecated - use childrenSize() for the number of children. | |
| virtual size_t | childrenSize () const |
| Returns the number of children BaseTree the receiver contains. | |
| const_iterator | begin () const |
| const_iterator | end () const |
| const_reverse_iterator | rbegin () const |
| const_reverse_iterator | rend () const |
BaseTree element.
This class has to be derived to contain anything. The default BaseTree class only has the tree structure, which can be used alone.
A tree is a tree node like any other, therefore only one class is provided.
| typedef std::list<BaseTree*>::const_iterator BaseTree::const_iterator |
| typedef std::list<BaseTree*>::const_reverse_iterator BaseTree::const_reverse_iterator |
| typedef std::list<BaseTree*>::iterator BaseTree::iterator |
| typedef std::list<BaseTree*>::reverse_iterator BaseTree::reverse_iterator |
|
inline |
Constructor.
| allowsChildren | if true (default) the node can hold children. If false, the node is terminal (leaf) and no children are allowed to be contained in it. |
Definition at line 125 of file base.h.
References BaseTree().
Referenced by BaseTree(), children(), clear(), getChildAt(), getIndex(), getParent(), getTopParent(), getTopParent(), insert(), remove(), setParent(), and Tree::Tree().
|
virtual |
|
inline |
| const std::list< BaseTree * > & BaseTree::children | ( | ) | const |
References BaseTree(), getAllowsChildren(), and getChildAt().
|
inlinevirtual |
| void BaseTree::clear | ( | ) |
Deletes all children from the tree.
References BaseTree(), begin(), childrenSize(), end(), rbegin(), rend(), and size().
|
inline |
|
inline |
Returns true if the receiver allows children.
Definition at line 131 of file base.h.
Referenced by children().
|
inline |
Returns the child BaseTree pointer at index childIndex.
Definition at line 137 of file base.h.
References BaseTree().
Referenced by children().
| int BaseTree::getIndex | ( | BaseTree * | node | ) | const |
Returns the index of node in the receivers children.
References BaseTree(), and getParent().
|
inline |
Returns the parent BaseTree of the receiver.
Definition at line 161 of file base.h.
References BaseTree().
Referenced by getIndex(), and removeFromParent().
| BaseTree * BaseTree::getTopParent | ( | ) |
Returns the top-level parent BaseTree of the receiver.
References BaseTree().
| const BaseTree * BaseTree::getTopParent | ( | ) | const |
Returns the top-level parent of the receiver (const version)
References BaseTree(), and isLeaf().
| void BaseTree::insert | ( | BaseTree * | child, |
| int | index = -1 ) |
Adds child to the receiver at index (default: end)
References BaseTree().
|
inline |
Returns true if the receiver is a leaf (terminal node)
Definition at line 167 of file base.h.
References size().
Referenced by getTopParent().
|
inline |
| void BaseTree::remove | ( | BaseTree * | node | ) |
Removes node from the receiver.
References BaseTree(), removeFromParent(), and setParent().
| void BaseTree::remove | ( | unsigned | index | ) |
Removes the child at index index from the receiver.
|
inline |
Removes the receiver from its parent.
Definition at line 197 of file base.h.
References getParent(), and setParent().
Referenced by remove().
|
inline |
|
inline |
Sets the parent of the receiver to newParent.
Definition at line 204 of file base.h.
References BaseTree().
Referenced by remove(), and removeFromParent().
|
inlinevirtual |