Intrusive Containers
|
Intrusive Singly Linked List, List. More...
#include <ListIn.h>
Protected Member Functions | |
ListInRoot () | |
Constructor. | |
~ListInRoot () | |
Destructor. | |
void | add (N &node, bool upgrade=false) |
Add node to our list, at "natural" point. | |
void | add (N *node, bool upgrade=false) |
Add node to our list, at "natural" point. | |
void | addFirst (N &node, bool upgrade=false) |
Add node to front of our list. | |
void | addFirst (N *node, bool upgrade=false) |
Add node to front of our list. | |
void | addLast (N &node, bool upgrade=false) |
Add node to end of our list. | |
void | addLast (N *node, bool upgrade=false) |
Add node to end of our list. | |
bool | check () const override |
N * | first () const |
Return pointer to first Node on list. | |
N * | last () const |
Return pointer to last Node on list. | |
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 |
Private Types | |
typedef ListInNode< R, N, s, n > | Node |
Type of ListInNode. | |
typedef ListInRoot< R, N, s, n > | Root |
Type of ListInRoot. | |
Private Attributes | |
friend | ListInNode< R, N, s, n > |
N * | m_first |
Pointer to first Node on list. | |
N * | m_last |
Pointer to last Node on list. | |
friend | N |
Intrusive Singly Linked List, List.
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. |
|
private |
Type of ListInNode.
|
private |
Type of ListInRoot.
|
protected |
Constructor.
Starts us as an empty 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. |
|
protected |
Destructor.
Removes all nodes attached to us.
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 node to our list, at "natural" point.
Note that this is the front for singly linked lists and the end for doubly linked 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. |
node | The node to add to the list If node is currently on a list (even us) it is removed before being added to the list |
upgrade | Set True if caller has an upgradable Read Lock (Used by SortDListInNode) |
|
inlineprotected |
Add node to our list, at "natural" point.
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. |
node | The node to add to the list If node is nulR, Nothing is done. If node is currently on a list (even us) it is removed before being added to the list |
upgrade | Set True if caller has an upgradable Read Lock (Used by SortDListInNode) |
|
inlineprotected |
Add node to front of our 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. |
node | The node to add to the list If node is currently on a list (even us) it is removed before being added to the list |
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 >::remove(), and ListInNode< R, N, s, n >::setRoot().
|
inlineprotected |
Add node to front of our 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. |
node | The node to add to the list If node is currently on a list (even us) it is removed before being added to the list |
upgrade | Set True if caller has an upgradable Read Lock (Used by SortDListInNode) |
|
inlineprotected |
Add node to end of our 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 |
node | The node to add to the list If node is currently on a list (even us) it is removed before being added to the list |
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 >::remove(), and ListInNode< R, N, s, n >::setRoot().
|
inlineprotected |
Add node to end of our list.
Note that this operation is O(n) on list current size. See DListInRoot to make this O(1).
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 to the list If node is currently on a list (even us) it is removed before being added to the list |
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 Container< s >.
Reimplemented in SortListInRoot< R, N, s, n >.
References ListInNode< R, N, s, n >::check(), ListInNode< R, N, s, n >::next(), and ListInNode< R, N, s, n >::root().
|
inlineprotected |
Return pointer to first Node on list.
References ListInRoot< R, N, s, n >::m_first.
|
inlineprotected |
Return pointer to last Node on list.
References ListInRoot< R, N, s, n >::m_last.
Referenced by ListInNode< R, N, s, n >::check().
|
inlineprotected |
|
inlineprotected |
|
inlineprotected |
Remove Node from 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. |
node | node to be removed. If node is not on this list, nothing will be done. |
References ListInNode< R, N, s, n >::m_root, and ListInNode< R, N, s, n >::remove().
|
inlineprotected |
Remove Node from 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. |
node | Pointer to node to be removed. If node is null, operation will be ignored. If node is not on this list, nothing will be done. |
|
inlineprotected |
|
inlineprotected |
|
private |
|
private |
Pointer to first Node on list.
Referenced by ListInRoot< R, N, s, n >::first(), and ListInNode< R, N, s, n >::remove().
|
private |
Pointer to last Node on list.
Referenced by ListInRoot< R, N, s, n >::last(), and ListInNode< R, N, s, n >::remove().
|
private |