Intrusive Containers
|
Intrusive Singly Linked List, Node. More...
#include <ListIn.h>
Protected Member Functions | |
ListInNode (R &myRoot) | |
Constructor. | |
ListInNode (R *myRoot=nullptr) | |
Constructor. | |
~ListInNode () | |
Destructor. | |
void | addAfter (N &myNode, bool upgrade=false) |
Add ourself to a list after another node. | |
void | addAfter (N *myNode, bool upgrade=false) |
Add ourself to a list after another node. | |
void | addTo (R &myRoot, bool upgrade=false) |
Add ourself to a list at "natural" postion. | |
void | addTo (R *myRoot, bool upgrade=false) |
Add ourself to a list at "natural" postion. | |
void | addToEnd (R &myRoot, bool upgrade=false) |
Add ourselfs to the end of a list. | |
void | addToEnd (R *myRoot, bool upgrade=false) |
Add ourselves to the End of a list. | |
void | addToFront (R &myRoot, bool upgrade=false) |
Add ourselfs to the front of a list. | |
void | addToFront (R *myRoot, bool upgrade=false) |
Add ourselfs to the front of a list. | |
bool | check () const override |
N * | next () const |
Return pointer to next Node on List. | |
unsigned | readLock (bool upgrade) const |
void | readUnlock (unsigned save) const |
void | remove () |
Remove node from whatever list it is on, if it is on a list. | |
R * | root () const |
Return pointer to List 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 ListInNode< R, N, s, n > | Node |
Type of ListInNode. | |
typedef ListInRoot< R, N, s, n > | Root |
Type of ListInRoot. | |
Private Attributes | |
friend | ListInRoot< R, N, s, n > |
N * | m_next |
Pointer to next Node in list. | |
R * | m_root |
Pointer to list we are on. | |
friend | R |
Intrusive Singly Linked List, Node.
R | The class that will be the owner of the List. Must derive from ListInRoot<R, N, n> |
N | The class that will be the nodes of the List. Must derive from ListInNode<R, N, n> |
n | A numerical parameter to allow a give List/Node combination to have multiple list-node relationships. Defaults to 0 if not provided. |
Last Criteria is closet expression to the fact that root.m_first points to a node that other node points to as its m_next
|
privateinherited |
The type of the Container that we are part of.
|
private |
Type of ListInNode.
|
private |
Type of ListInRoot.
|
protected |
Constructor.
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> |
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. |
myRoot | list we are to be added to. |
References ListInNode< R, N, s, n >::addTo().
|
protected |
Constructor.
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> |
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. |
myRoot | Pointer to list for node to be added to (if not NULL). |
References ListInNode< R, N, s, n >::addTo().
|
protected |
Destructor.
Remove us from we are on, if any.
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> |
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. |
|
inlineprotected |
Add ourself to a list after another node.
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> |
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. |
node | The node to add ourself after. If node is not on a list, do nothing. |
upgrade | Set True if caller has an upgradable Read Lock (Used by SortDListInNode) |
References ListInNode< R, N, s, n >::m_next, ListInNode< R, N, s, n >::m_root, ListInNode< R, N, s, n >::writeLock(), and ListInNode< R, N, s, n >::writeUnlock().
|
inlineprotected |
Add ourself to a list after another node.
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> |
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. |
node | The node to add ourself after. If Node is NULL, or not on a list, do nothing. |
upgrade | Set True if caller has an upgradable Read Lock (Used by SortDListInNode) |
|
protected |
Add ourself to a list at "natural" postion.
Note that this is the front for singly linked lists, and the end for doubly linked lists.
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> |
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. |
myRoot | List to add to. |
upgrade | Set True if caller has an upgradable Read Lock (Used by SortDListInNode) |
Referenced by ListInNode< R, N, s, n >::ListInNode(), and ListInNode< R, N, s, n >::ListInNode().
|
protected |
Add ourself to a list at "natural" postion.
Note that this is the front for singly linked lists, and the end for doubly linked lists.
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> |
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. |
myRoot | List to add to. |
upgrade | Set True if caller has an upgradable Read Lock (Used by SortDListInNode) |
|
inlineprotected |
Add ourselfs to the end of a list.
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> |
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. |
myRoot | List to add to. |
upgrade | Set True if caller has an upgradable Read Lock (Used by SortDListInNode) |
|
inlineprotected |
Add ourselves to the End of a list.
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> |
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. |
myRoot | List to add to. If NULL, just remove from all lists. |
upgrade | Set True if caller has an upgradable Read Lock (Used by SortDListInNode) |
|
inlineprotected |
Add ourselfs to the front of a list.
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> |
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. |
myRoot | List to add to. |
upgrade | Set True if caller has an upgradable Read Lock (Used by SortDListInNode) |
|
inlineprotected |
Add ourselfs to the front of a list.
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> |
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. |
myRoot | List to add to. If NULL, just remove from all lists. |
upgrade | Set True if caller has an upgradable Read Lock (Used by SortDListInNode) |
|
overrideprotectedvirtual |
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> |
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. |
Implements ContainerNode< s >.
Reimplemented in SortListInNode< R, N, s, n >.
References ListInRoot< R, N, s, n >::last(), and ListInNode< R, N, s, n >::root().
Referenced by ListInRoot< R, N, s, n >::check().
|
inlineprotected |
Return pointer to next Node on List.
References ListInNode< R, N, s, n >::m_next.
Referenced by ListInRoot< R, N, s, n >::check().
|
inlineprotected |
|
inlineprotected |
|
inlineprotected |
Remove node from whatever list it is on, if it is on a list.
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> |
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. |
References ListInRoot< R, N, s, n >::m_first, ListInRoot< R, N, s, n >::m_last, and ListInNode< R, N, s, n >::m_next.
Referenced by ListInRoot< R, N, s, n >::addFirst(), ListInRoot< R, N, s, n >::addLast(), and ListInRoot< R, N, s, n >::remove().
|
inlineprotected |
Return pointer to List we are on.
References ListInNode< R, N, s, n >::m_root.
Referenced by ListInNode< R, N, s, n >::check(), ListInRoot< R, N, s, n >::check(), and ListInNode< R, N, 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 ListInNode< R, N, s, n >::m_root, ListInNode< R, N, s, n >::root(), and ContainerNode< s >::setRoot().
Referenced by ListInRoot< R, N, s, n >::addFirst(), and ListInRoot< R, N, s, n >::addLast().
|
inlineprotected |
References ContainerNode< s >::writeLock().
Referenced by ListInNode< R, N, s, n >::addAfter().
|
inlineprotected |
References ContainerNode< s >::writeUnlock().
Referenced by ListInNode< R, N, s, n >::addAfter().
|
private |
|
private |
Pointer to next Node in list.
Referenced by ListInNode< R, N, s, n >::addAfter(), ListInRoot< R, N, s, n >::addFirst(), ListInRoot< R, N, s, n >::addLast(), ListInNode< R, N, s, n >::next(), and ListInNode< R, N, s, n >::remove().
|
private |
Pointer to list we are on.
Referenced by ListInNode< R, N, s, n >::addAfter(), ListInRoot< R, N, s, n >::addFirst(), ListInRoot< R, N, s, n >::addLast(), ListInRoot< R, N, s, n >::remove(), ListInNode< R, N, s, n >::root(), and ListInNode< R, N, s, n >::setRoot().
|
private |