Intrusive Containers
|
Intrusive Binary Tree, Node. More...
#include <TreeIn.h>
Protected Member Functions | |
TreeInNode () | |
Constructor. | |
virtual | ~TreeInNode () |
Destructor. | |
void | addTo (R &root) |
Add ourself to a tree. | |
void | addTo (R *root) |
Add ourself to a tree. | |
bool | check () const override |
N * | left () const |
N * | next () const |
Return node next in sort sequence. | |
N * | parent () const |
N * | prev () const |
Return previous node in sort sequence. | |
unsigned | readLock (bool upgrade) const |
void | readUnlock (unsigned save) const |
virtual void | rebalance () |
Hook to allow Balanced trees to rebalance from current node, just changed. | |
virtual void | remove () |
Remove node from whatever tree it is on, if it is on a tree. | |
void | resort () |
N * | right () const |
R * | root () const |
Return pointer to tree we are on. | |
void | setRoot (C *root) |
Set our Container. | |
void | setRoot (R *root) |
unsigned | writeLock (bool upgrade) const |
void | writeUnlock (unsigned save) const |
Private Types | |
typedef Container< s > | C |
The type of the Container that we are part of. | |
typedef class TreeInNode< R, N, K, s, n > | Node |
Type of DListIInNode. | |
typedef class TreeInRoot< R, N, K, s, n > | Root |
Type of TreeInRoot. | |
Private Attributes | |
N * | m_left |
Pointer to left (lesser) child node on tree. | |
N * | m_parent |
Pointer to parent node on tree. | |
N * | m_right |
Pointer to right (greater) child node on tree. | |
R * | m_root |
Pointer to tree we are on. | |
Friends | |
class | BalTreeInNode< R, N, K, s, n > |
Let Balancer get to us. | |
class | TreeInRoot< R, N, K, s, n > |
Intrusive Binary Tree, Node.
R | The class that will be the owner of the List. Must derive from TreeInRoot<R, N, K, n> |
N | The class that will be the nodes of the List. 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. |
Summary:
|
privateinherited |
The type of the Container that we are part of.
|
private |
Type of DListIInNode.
|
private |
Type of TreeInRoot.
|
protected |
Constructor.
|
protectedvirtual |
Destructor.
Remove us from we are on, if any.
|
protected |
Add ourself to a tree.
myroot | Tree to add to. |
|
protected |
Add ourself to a tree.
myroot | Tree to add to. |
|
inlineoverrideprotectedvirtual |
Implements ContainerNode< s >.
|
inlineprotected |
References TreeInNode< R, N, K, s, n >::m_left.
|
inlineprotected |
Return node next in sort sequence.
|
inlineprotected |
References TreeInNode< R, N, K, s, n >::m_parent.
|
inlineprotected |
Return previous node in sort sequence.
|
inlineprotected |
|
inlineprotected |
|
inlineprotectedvirtual |
Hook to allow Balanced trees to rebalance from current node, just changed.
Reimplemented in AATreeInNode< R, N, K, s, n >, and BalTreeInNode< R, N, K, s, n >.
|
inlineprotectedvirtual |
Remove node from whatever tree it is on, if it is on a tree.
Delete Node N Simple Cases, Not both childern (x is empty link) P P P P P P | => x | => | | => | N N L N R x x / x \ L R Rebalance at P More Complicated, as we have both childern More Complicated Special Case P P P P | => | | => | N D N L / \ / \ / \ / \ L R L R L R A R \ \ / x A A A \ \ B B \ \ D C / x C Rebalance at B. D might be L if it had no right child in which case rebalance at L L < A < B < C < D < N < R Link to P either a left or right, or Root if P is NULL. x indicates NULL links
|
protected |
|
inlineprotected |
References TreeInNode< R, N, K, s, n >::m_right.
|
inlineprotected |
Return pointer to tree we are on.
References TreeInNode< R, N, K, s, n >::m_root.
Referenced by TreeInNode< R, N, K, s, n >::setRoot().
|
inlineprotectedinherited |
Set our Container.
Used to allow to Node to record what Container it is in. Used only if safety method need resources from the Container, like a Mutex
If an operation changes the root of a node, then it needs to save the original root to exit the critical section on that container that it entered before the operation.
Referenced by ContainerNode< s >::ContainerNode(), DListInNode< R, N, s, n >::setRoot(), ListInNode< R, N, s, n >::setRoot(), and TreeInNode< R, N, K, s, n >::setRoot().
|
inlineprotected |
References TreeInNode< R, N, K, s, n >::m_root, TreeInNode< R, N, K, s, n >::root(), and ContainerNode< s >::setRoot().
|
inlineprotected |
|
inlineprotected |
|
friend |
Let Balancer get to us.
|
friend |
|
private |
Pointer to left (lesser) child node on tree.
Referenced by TreeInNode< R, N, K, s, n >::left().
|
private |
Pointer to parent node on tree.
Referenced by TreeInNode< R, N, K, s, n >::parent().
|
private |
Pointer to right (greater) child node on tree.
Referenced by TreeInNode< R, N, K, s, n >::right().
|
private |
Pointer to tree we are on.
Referenced by TreeInNode< R, N, K, s, n >::root(), and TreeInNode< R, N, K, s, n >::setRoot().