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

Intrusive Doubly Linked List, Node. More...

#include <DListIn.h>

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

Public Member Functions

 DListInNode (R &)
 Constructor.
 
 DListInNode (R *root=nullptr)
 Constructor.
 
 ~DListInNode ()
 Destructor.
 
void addAfter (N &node, bool upgrade=false)
 Add ourself to a list after another node.
 
void addAfter (N *node, bool upgrade=false)
 Add ourself to a list after another node.
 
void addTo (R &root, bool upgrade=false)
 Add ourself to a list at "natural" postion.
 
void addTo (R *root, bool upgrade=false)
 Add ourself to a list at "natural" postion.
 
void addToEnd (R &root, bool upgrade=false)
 Add ourselfs to the end of a list.
 
void addToEnd (R *root, bool upgrade=false)
 Add ourselfs to the End of a list.
 
void addToFront (R &root, bool upgrade=false)
 Add ourselves to the front of a list.
 
void addToFront (R *root, bool upgrade=false)
 Add ourselfs to the front of a list.
 
bool check () const override
 Check a DListInNode.
 
N * next () const
 Return pointer to next node on list.
 
N * prev () const
 Return pointer to previous 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 (R *root)
 
unsigned writeLock (bool upgrade) const
 
void writeUnlock (unsigned save) const
 

Protected Member Functions

void setRoot (C *root)
 Set our Container.
 

Private Types

typedef Container< s > C
 The type of the Container that we are part of.
 
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_next
 Pointer to net node on list.
 
N * m_prev
 Pointer to previous node on list.
 
R * m_root
 Pointer to list we are on.
 

Friends

class DListInRoot< R, N, s, n >
 

Detailed Description

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

Intrusive Doubly Linked List, Node.

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>
sThe ContainerThreadSaftey 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.
Invariant
  • if m_root == nullptr
    • m_nest == nullptr
    • m_prev == nullptr
  • if m_prev == nullptr
    • m_root->m_first = this;
  • if m_prev !- nullptr
    • m_prev->m_root == m_root
    • m_orev->m_next == this
  • if m_next == nullptr
    • m_root->m_last = this
  • if m_next != nullptr
    • m_next->m_root == m_root
    • m_next->m_prev == this
See also
DListInRoot

Member Typedef Documentation

◆ C

template<ContainerThreadSafety s>
Container<s> ContainerNode< s >::C
privateinherited

The type of the Container that we are part of.

◆ Node

template<class R , class N , ContainerThreadSafety s, int n>
class DListInNode< R, N, s, n > DListInNode< 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 > DListInNode< R, N, s, n >::Root
private

Type of DListInRoot.

Constructor & Destructor Documentation

◆ DListInNode() [1/2]

template<class R , class N , ContainerThreadSafety s, int n>
DListInNode< R, N, s, n >::DListInNode ( R * myRoot = nullptr)

Constructor.

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
myRootPointer to list for node to be added to (if not NULL).

References DListInNode< R, N, s, n >::addTo().

Here is the call graph for this function:

◆ DListInNode() [2/2]

template<class R , class N , ContainerThreadSafety s, int n>
DListInNode< R, N, s, n >::DListInNode ( R & myRoot)

Constructor.

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
myRootlist we are to be added to.

References DListInNode< R, N, s, n >::addTo().

Here is the call graph for this function:

◆ ~DListInNode()

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

Destructor.

Remove us from list we are on, if any.

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

◆ addAfter() [1/2]

template<class R , class N , ContainerThreadSafety s, int n>
void DListInNode< R, N, s, n >::addAfter ( N & node,
bool upgrade = false )
inline

Add ourself to a list after another node.

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 ourself after. If that node is not on a list, do nothing.
upgradeSet True if caller has an upgradable Read Lock (Used by SortDListInNode)

◆ addAfter() [2/2]

template<class R , class N , ContainerThreadSafety s, int n>
void DListInNode< R, N, s, n >::addAfter ( N * node,
bool upgrade = false )
inline

Add ourself to a list after another node.

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 ourself after. If Node is NULL, or not on a list, do nothing.
upgradeSet True if caller has an upgradable Read Lock (Used by SortDListInNode)

◆ addTo() [1/2]

template<class R , class N , ContainerThreadSafety s, int n>
void DListInNode< R, N, s, n >::addTo ( R & myRoot,
bool upgrade = false )

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.

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
myRootList to add to.
upgradeSet True if caller has an upgradable Read Lock (Used by SortDListInNode)

Referenced by DListInNode< R, N, s, n >::DListInNode(), and DListInNode< R, N, s, n >::DListInNode().

Here is the caller graph for this function:

◆ addTo() [2/2]

template<class R , class N , ContainerThreadSafety s, int n>
void DListInNode< R, N, s, n >::addTo ( R * myRoot,
bool upgrade = false )

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.

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
myRootList to add to.
upgradeSet True if caller has an upgradable Read Lock (Used by SortDListInNode)

◆ addToEnd() [1/2]

template<class R , class N , ContainerThreadSafety s, int n>
void DListInNode< R, N, s, n >::addToEnd ( R & myRoot,
bool upgrade = false )
inline

Add ourselfs to the end of a 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
myRootList to add to.
upgradeSet True if caller has an upgradable Read Lock (Used by SortDListInNode)

◆ addToEnd() [2/2]

template<class R , class N , ContainerThreadSafety s, int n>
void DListInNode< R, N, s, n >::addToEnd ( R * myRoot,
bool upgrade = false )
inline

Add ourselfs to the End of a 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
myRootList to add to.
upgradeSet True if caller has an upgradable Read Lock (Used by SortDListInNode)

If NULL, just remove from all lists.

◆ addToFront() [1/2]

template<class R , class N , ContainerThreadSafety s, int n>
void DListInNode< R, N, s, n >::addToFront ( R & myRoot,
bool upgrade = false )
inline

Add ourselves to the front of a 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
myRootList to add to.
upgradeSet True if caller has an upgradable Read Lock (Used by SortDListInNode)

◆ addToFront() [2/2]

template<class R , class N , ContainerThreadSafety s, int n>
void DListInNode< R, N, s, n >::addToFront ( R * myRoot,
bool upgrade = false )
inline

Add ourselfs to the front of a 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
myRootList to add to. If NULL, just remove from all lists.
upgradeSet True if caller has an upgradable Read Lock (Used by SortDListInNode)

◆ check()

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

Check a DListInNode.

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 ContainerNode< s >.

Reimplemented in ManyManyLink< R, N, s, n, L >, ManyManyLink< R, N, s, n, ManyManyLink< R, N, s, n, void > >, and SortDListInNode< R, N, s, n >.

◆ next()

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

Return pointer to next node on list.

References DListInNode< R, N, s, n >::m_next.

◆ prev()

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

Return pointer to previous node on list.

References DListInNode< R, N, s, n >::m_prev.

◆ readLock()

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

References ContainerNode< s >::readLock().

Here is the call graph for this function:

◆ readUnlock()

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

References ContainerNode< s >::readUnlock().

Here is the call graph for this function:

◆ remove()

template<class R , class N , ContainerThreadSafety s, int n>
void DListInNode< R, N, s, n >::remove ( )
inline

Remove node from whatever list it is on, if it is on a 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.

◆ root()

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

Return pointer to list we are on.

References DListInNode< R, N, s, n >::m_root.

Referenced by DListInNode< R, N, s, n >::setRoot().

Here is the caller graph for this function:

◆ setRoot() [1/2]

template<ContainerThreadSafety s>
void ContainerNode< s >::setRoot ( C * root)
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().

Here is the caller graph for this function:

◆ setRoot() [2/2]

template<class R , class N , ContainerThreadSafety s, int n>
void DListInNode< R, N, s, n >::setRoot ( R * root)
inline

References DListInNode< R, N, s, n >::m_root, DListInNode< R, N, s, n >::root(), and ContainerNode< s >::setRoot().

Here is the call graph for this function:

◆ writeLock()

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

References ContainerNode< s >::writeLock().

Here is the call graph for this function:

◆ writeUnlock()

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

References ContainerNode< s >::writeUnlock().

Here is the call graph for this function:

Friends And Related Symbol Documentation

◆ DListInRoot< R, N, s, n >

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

Member Data Documentation

◆ m_next

template<class R , class N , ContainerThreadSafety s, int n>
N* DListInNode< R, N, s, n >::m_next
private

Pointer to net node on list.

Referenced by DListInNode< R, N, s, n >::next().

◆ m_prev

template<class R , class N , ContainerThreadSafety s, int n>
N* DListInNode< R, N, s, n >::m_prev
private

Pointer to previous node on list.

Referenced by DListInNode< R, N, s, n >::prev().

◆ m_root

template<class R , class N , ContainerThreadSafety s, int n>
R* DListInNode< R, N, s, n >::m_root
private

Pointer to list we are on.

Referenced by DListInNode< R, N, s, n >::root(), and DListInNode< R, N, s, n >::setRoot().


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