|
| TreeInRoot () |
| Constructor.
|
|
virtual | ~TreeInRoot () |
| Destructor.
|
|
virtual void | add (N &node) |
| Add node to our tree, note trees are sorted by the compare member function which needs to be implemented by the user.
|
|
void | add (N *node) |
| Add node to our tree.
|
|
N * | base () const |
|
bool | check () const override |
|
int | compare (N const &node1, N const &node2) const |
| Compare Nodes Should return >0 if node2 > node1, and <0 if node2 < node1, 0 if equal.
|
|
int | compareKey (N const &node, K key) const |
| Compare Key to node Should return >0 if key > node, <0 if key < node, 0 if key == node.
|
|
N * | find (K key) const |
| find a node
|
|
N * | findMinus (K key) const |
| find a node, or the node that would be just lower than this node
|
|
N * | findPlus (K key) const |
| find a node, r the node that would be just above this node.
|
|
N * | first () const |
|
N * | last () const |
|
unsigned | readLock (bool upgrade) const |
|
void | readUnlock (unsigned save) const |
|
void | remove (N &node) |
| Remove Node from List.
|
|
void | remove (N *node) |
| Remove Node from List.
|
|
unsigned | writeLock (bool upgrade) const |
|
void | writeUnlock (unsigned save) const |
|
Intrusive Binary Tree, Root.
- Template Parameters
-
R | The class that will be the owner of the Tree. Must derive from TreeInRoot<R, N, K, n> |
N | The class that will be the nodes of the Tree. Must derive from TreeInNode<R, N, K, n> |
K | The class defining the Key used to lookup Nodes in the tree. |
s | The ContainerThreadSafety value to define the thread safety model of the Container |
n | A numerical parameter to allow a give List/Node combination to have multiple list-node relationships. Defaults to 0 if not provided. |
- Invariant
- if m_base != nullptr:
- m_base->m_root == this.
- m_base->m_parent == nullptr
- See also
- TreeInNode
Tree Structure
Summary:
- Root:
- Base pointer to the Base node of the Tree
- Node
- (Red) Nodes have a Root pointer to the Root structure for the tree
- (Blue) Parent pointer to the Node leading to the base of the Tree.
- The node will be on the Left or Right of that Parent.
- The Base node will have a null parent.
- Left pointer to the subtree of Nodes that are less than this node
- Right pointer to the subtree of Nodes that are greater than this node