Intrusive Containers
Loading...
Searching...
No Matches
DListInRoot< R, N, s, n > Class Template Reference

Intrusive Doubly Linked List, List. More...

#include <DListIn.h>

Inheritance diagram for DListInRoot< R, N, s, n >:
Collaboration diagram for DListInRoot< R, N, s, n >:

Public Member Functions

 DListInRoot ()
 Constructor.
 
 ~DListInRoot ()
 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
 Check a DListInRoot and the list connected.
 
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
 

Private Types

typedef class DListInNode< R, N, s, n > Node
 Type of DListIInNode.
 
typedef class DListInRoot< R, N, s, n > Root
 Type of DListInRoot.
 

Private Attributes

N * m_first
 Pointer to first node on list.
 
N * m_last
 Pointer to last node on list.
 

Friends

class DListInNode< R, N, s, n >
 

Detailed Description

template<class R, class N, ContainerThreadSafety s, int n>
class DListInRoot< R, N, s, n >

Intrusive Doubly Linked List, List.

Template Parameters
RThe class that will be the owner of the List. Must derive from DListInRoot<R, N, n>
NThe class that will be the nodes of the List. Must derive from DListInNode<R, N, n>
s
nA numerical parameter to allow a give List/Node combination to have multiple list-node relationships. Defaults to 0 if not provided.
Invariant
  • if m_first == nullptr
    • m_last == nullptr
  • if m_first !- nullptr
    • m_last != nullptr
    • m_first->m_root == this
    • m_first->m_prev == nullptr
    • m_last->m_root == this
    • m_last->m_next == nullptr
See also
DListInNode

Member Typedef Documentation

◆ Node

template<class R , class N , ContainerThreadSafety s, int n>
class DListInNode< R, N, s, n > DListInRoot< R, N, s, n >::Node
private

Type of DListIInNode.

◆ Root

template<class R , class N , ContainerThreadSafety s, int n>
class DListInRoot< R, N, s, n > DListInRoot< R, N, s, n >::Root
private

Type of DListInRoot.

Constructor & Destructor Documentation

◆ DListInRoot()

template<class R , class N , ContainerThreadSafety s, int n>
DListInRoot< R, N, s, n >::DListInRoot ( )

Constructor.

Starts us as an empty list.

Template Parameters
RThe class that will be the owner of the Tree. Must derive from TreeInRoot<R, N, K, n>
NThe class that will be the nodes of the Tree. Must derive from TreeInNode<R, N, K, n>
sThe ContainerThreadSafety value to define the thread safety model of the Container
nA numerical parameter to allow a give List/Node combination to have multiple list-node relationships. Defaults to 0 if not provided.

◆ ~DListInRoot()

template<class R , class N , ContainerThreadSafety s, int n>
DListInRoot< R, N, s, n >::~DListInRoot ( )

Destructor.

Removes all nodes attached to us.

Template Parameters
RThe class that will be the owner of the Tree. Must derive from TreeInRoot<R, N, K, n>
NThe class that will be the nodes of the Tree. Must derive from TreeInNode<R, N, K, n>
sThe ContainerThreadSafety value to define the thread safety model of the Container
nA numerical parameter to allow a give List/Node combination to have multiple list-node relationships. Defaults to 0 if not provided.

Member Function Documentation

◆ add() [1/2]

template<class R , class N , ContainerThreadSafety s, int n_>
void DListInRoot< R, N, s, n_ >::add ( N & node,
bool upgrade = false )
inline

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.

If node is currently on a list (even us) it is removed before being added to the list

Template Parameters
RThe class that will be the owner of the Tree. Must derive from TreeInRoot<R, N, K, n>
NThe class that will be the nodes of the Tree. Must derive from TreeInNode<R, N, K, n>
sThe ContainerThreadSafety value to define the thread safety model of the Container
nA numerical parameter to allow a give List/Node combination to have multiple list-node relationships. Defaults to 0 if not provided.
Parameters
nodeThe node to add to the list
upgradeSet True if caller has an upgradable Read Lock (Used by SortDListInNode)

◆ add() [2/2]

template<class R , class N , ContainerThreadSafety s, int n_>
void DListInRoot< R, N, s, n_ >::add ( N * node,
bool upgrade = false )
inline

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.

Template Parameters
RThe class that will be the owner of the Tree. Must derive from TreeInRoot<R, N, K, n>
NThe class that will be the nodes of the Tree. Must derive from TreeInNode<R, N, K, n>
sThe ContainerThreadSafety value to define the thread safety model of the Container
nA numerical parameter to allow a give List/Node combination to have multiple list-node relationships. Defaults to 0 if not provided.
Parameters
nodeThe 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
upgradeSet True if caller has an upgradable Read Lock (Used by SortDListInNode)

◆ addFirst() [1/2]

template<class R , class N , ContainerThreadSafety s, int n_>
void DListInRoot< R, N, s, n_ >::addFirst ( N & node,
bool upgrade = false )
inline

Add node to front of our list.

Template Parameters
RThe class that will be the owner of the Tree. Must derive from TreeInRoot<R, N, K, n>
NThe class that will be the nodes of the Tree. Must derive from TreeInNode<R, N, K, n>
sThe ContainerThreadSafety value to define the thread safety model of the Container
nA numerical parameter to allow a give List/Node combination to have multiple list-node relationships. Defaults to 0 if not provided.
Parameters
nodeThe node to add to the list If node is currently on a list (even us) it is removed before being added to the list
upgradeSet True if caller has an upgradable Read Lock (Used by SortDListInRoot)

◆ addFirst() [2/2]

template<class R , class N , ContainerThreadSafety s, int n_>
void DListInRoot< R, N, s, n_ >::addFirst ( N * node,
bool upgrade = false )
inline

Add node to front of our list.

Template Parameters
RThe class that will be the owner of the Tree. Must derive from TreeInRoot<R, N, K, n>
NThe class that will be the nodes of the Tree. Must derive from TreeInNode<R, N, K, n>
sThe ContainerThreadSafety value to define the thread safety model of the Container
nA numerical parameter to allow a give List/Node combination to have multiple list-node relationships. Defaults to 0 if not provided.
Parameters
nodeThe node to add to the list If node is currently on a list (even us) it is removed before being added to the list
upgradeSet True if caller has an upgradable Read Lock (Used by SortDListInRoot)

◆ addLast() [1/2]

template<class R , class N , ContainerThreadSafety s, int n_>
void DListInRoot< R, N, s, n_ >::addLast ( N & node,
bool upgrade = false )
inline

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).

Template Parameters
RThe class that will be the owner of the Tree. Must derive from TreeInRoot<R, N, K, n>
NThe class that will be the nodes of the Tree. Must derive from TreeInNode<R, N, K, n>
sThe ContainerThreadSafety value to define the thread safety model of the Container
nA numerical parameter to allow a give List/Node combination to have multiple list-node relationships. Defaults to 0 if not provided.
Parameters
nodeThe node to add to the list If node is currently on a list (even us) it is removed before being added to the list
upgradeSet True if caller has an upgradable Read Lock (Used by SortDListInRoot)

◆ addLast() [2/2]

template<class R , class N , ContainerThreadSafety s, int n_>
void DListInRoot< R, N, s, n_ >::addLast ( N * node,
bool upgrade = false )
inline

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).

Template Parameters
RThe class that will be the owner of the Tree. Must derive from TreeInRoot<R, N, K, n>
NThe class that will be the nodes of the Tree. Must derive from TreeInNode<R, N, K, n>
sThe ContainerThreadSafety value to define the thread safety model of the Container
nA numerical parameter to allow a give List/Node combination to have multiple list-node relationships. Defaults to 0 if not provided.
Parameters
nodeThe node to add to the list If node is currently on a list (even us) it is removed before being added to the list
upgradeSet True if caller has an upgradable Read Lock (Used by SortDListInRoot)

◆ check()

template<class R , class N , ContainerThreadSafety s, int n>
bool DListInRoot< R, N, s, n >::check ( ) const
overridevirtual

Check a DListInRoot and the list connected.

Template Parameters
RThe class that will be the owner of the Tree. Must derive from TreeInRoot<R, N, K, n>
NThe class that will be the nodes of the Tree. Must derive from TreeInNode<R, N, K, n>
sThe ContainerThreadSafety value to define the thread safety model of the Container
nA numerical parameter to allow a give List/Node combination to have multiple list-node relationships. Defaults to 0 if not provided.
Returns
true if check passes

Implements Container< s >.

Reimplemented in ManyManyNode< R, N, s, n, L >, ManyManyRoot< R, N, s, n, L >, and SortDListInRoot< R, N, s, n >.

◆ first()

template<class R , class N , ContainerThreadSafety s, int n>
N * DListInRoot< R, N, s, n >::first ( ) const
inline

◆ last()

template<class R , class N , ContainerThreadSafety s, int n>
N * DListInRoot< R, N, s, n >::last ( ) const
inline

◆ readLock()

template<class R , class N , ContainerThreadSafety s, int n>
unsigned DListInRoot< R, N, s, n >::readLock ( bool upgrade) const
inline

References Container< s >::readLock().

Here is the call graph for this function:

◆ readUnlock()

template<class R , class N , ContainerThreadSafety s, int n>
void DListInRoot< R, N, s, n >::readUnlock ( unsigned save) const
inline

References Container< s >::readUnlock().

Here is the call graph for this function:

◆ remove() [1/2]

template<class R , class N , ContainerThreadSafety s, int n_>
void DListInRoot< R, N, s, n_ >::remove ( N & node)
inline

Remove Node from List.

Template Parameters
RThe class that will be the owner of the Tree. Must derive from TreeInRoot<R, N, K, n>
NThe class that will be the nodes of the Tree. Must derive from TreeInNode<R, N, K, n>
sThe ContainerThreadSafety value to define the thread safety model of the Container
nA numerical parameter to allow a give List/Node combination to have multiple list-node relationships. Defaults to 0 if not provided.
Parameters
nodenode to be removed.

If node is not on this list, nothing will be done.

◆ remove() [2/2]

template<class R , class N , ContainerThreadSafety s, int n_>
void DListInRoot< R, N, s, n_ >::remove ( N * node)
inline

Remove Node from List.

Template Parameters
RThe class that will be the owner of the Tree. Must derive from TreeInRoot<R, N, K, n>
NThe class that will be the nodes of the Tree. Must derive from TreeInNode<R, N, K, n>
sThe ContainerThreadSafety value to define the thread safety model of the Container
nA numerical parameter to allow a give List/Node combination to have multiple list-node relationships. Defaults to 0 if not provided.
Parameters
nodePointer to node to be removed. If node is null, operation will be ignored. If node is not on this list, nothing will be done.

◆ writeLock()

template<class R , class N , ContainerThreadSafety s, int n>
unsigned DListInRoot< R, N, s, n >::writeLock ( bool upgrade) const
inline

References Container< s >::writeLock().

Here is the call graph for this function:

◆ writeUnlock()

template<class R , class N , ContainerThreadSafety s, int n>
void DListInRoot< R, N, s, n >::writeUnlock ( unsigned save) const
inline

References Container< s >::writeUnlock().

Here is the call graph for this function:

Friends And Related Symbol Documentation

◆ DListInNode< R, N, s, n >

template<class R , class N , ContainerThreadSafety s, int n>
friend class DListInNode< R, N, s, n >
friend

Member Data Documentation

◆ m_first

template<class R , class N , ContainerThreadSafety s, int n>
N* DListInRoot< R, N, s, n >::m_first
private

Pointer to first node on list.

Referenced by DListInRoot< R, N, s, n >::first().

◆ m_last

template<class R , class N , ContainerThreadSafety s, int n>
N* DListInRoot< R, N, s, n >::m_last
private

Pointer to last node on list.

Referenced by DListInRoot< R, N, s, n >::last().


The documentation for this class was generated from the following files: