Intrusive Containers
|
Intermediate Link for a many-many relationship. More...
#include <ManyMany.h>
Public Member Functions | |
ManyManyLink (R *root=nullptr, N *node=nullptr, L *link1=nullptr, L *link2=nullptr) | |
virtual | ~ManyManyLink () |
void | add (R &root, N &node) |
void | add (R *root, N *node, L *link1=nullptr, L *link2=nullptr) |
Link a Root to a Node with this Lisk. | |
void | addAfter (L &node, bool upgrade=false) |
Add ourself to a list after another node. | |
void | addAfter (L *node, bool upgrade=false) |
Add ourself to a list after another node. | |
void | addAfter (L &node, bool upgrade=false) |
Add ourself to a list after another node. | |
void | addAfter (L *node, bool upgrade=false) |
Add ourself to a list after another node. | |
void | addTo (N &root, bool upgrade=false) |
Add ourself to a list at "natural" postion. | |
void | addTo (N *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 | addTo (R *root, bool upgrade=false) |
Add ourself to a list at "natural" postion. | |
void | addToEnd (N &root, bool upgrade=false) |
Add ourselfs to the end of a list. | |
void | addToEnd (N *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 | addToEnd (R *root, bool upgrade=false) |
Add ourselfs to the End of a list. | |
void | addToFront (N &root, bool upgrade=false) |
Add ourselves to the front of a list. | |
void | addToFront (N *root, bool upgrade=false) |
Add ourselfs to the front 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. | |
L * | next () const |
Return pointer to next node on list. | |
L * | next () const |
Return pointer to next node on list. | |
L * | nextNode () const |
L * | nextRoot () const |
N * | node () const |
L * | prev () const |
Return pointer to previous node on list. | |
L * | prev () const |
Return pointer to previous node on list. | |
L * | prevNode () const |
L * | prevRoot () const |
unsigned | readLock (bool upgrade) const |
unsigned | readLock (bool upgrade) const |
void | readUnlock (unsigned save) const |
void | readUnlock (unsigned save) const |
void | remove () |
R * | root () const |
void | setRoot (N *root) |
void | setRoot (R *root) |
unsigned | writeLock (bool upgrade) const |
unsigned | writeLock (bool upgrade) const |
void | writeUnlock (unsigned save) const |
void | writeUnlock (unsigned save) const |
Protected Member Functions | |
void | setRoot (C *root) |
Set our Container. | |
void | setRoot (C *root) |
Set our Container. | |
Private Types | |
typedef class DListInNode< N, L, s, 2 *n+1 > | BaseNode |
typedef class DListInNode< R, L, s, 2 *n > | BaseRoot |
typedef Container< s > | C |
The type of the Container that we are part of. | |
typedef class ManyManyLink< R, N, s, n, L > | Link |
typedef class ManyManyNode< R, N, s, n, L > | Node |
typedef class ManyManyRoot< R, N, s, n, L > | Root |
typedef class DListInRoot< N, L, s, 2 *n+1 > | RootNode |
typedef class DListInRoot< R, L, s, 2 *n > | RootRoot |
Static Private Member Functions | |
static L & | getLink (L *link) |
Convert a possible link pointer into an actual link object. | |
Private Attributes | |
bool | m_dynamic = false |
L * | m_next |
Pointer to net node on list. | |
L * | m_prev |
Pointer to previous node on list. | |
R * | m_root |
Pointer to list we are on. | |
friend | Node |
friend | Root |
Intermediate Link for a many-many relationship.
Allowed to be pointing to a user class to allow properties on the relationship.
|
private |
|
private |
|
privateinherited |
The type of the Container that we are part of.
|
private |
|
private |
|
private |
|
private |
|
private |
ManyManyLink< R, N, s, n, L >::ManyManyLink | ( | R * | root = nullptr, |
N * | node = nullptr, | ||
L * | link1 = nullptr, | ||
L * | link2 = nullptr ) |
|
virtual |
void ManyManyLink< R, N, s, n, L >::add | ( | R & | root, |
N & | node ) |
void ManyManyLink< R, N, s, n, L >::add | ( | R * | root, |
N * | node, | ||
L * | link1 = nullptr, | ||
L * | link2 = nullptr ) |
Link a Root to a Node with this Lisk.
R | |
N | |
L | |
s | |
n |
root | |
node | |
link1 | |
link2 |
If link1 or link2 point to either the Root or Node we are to connect to, then we will link ourselves on that side just after that link. Otherwise we link at the front of the lists.
|
inlineinherited |
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 that node is not on a list, do nothing. |
upgrade | Set True if caller has an upgradable Read Lock (Used by SortDListInNode) |
|
inlineinherited |
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) |
|
inlineinherited |
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 that node is not on a list, do nothing. |
upgrade | Set True if caller has an upgradable Read Lock (Used by SortDListInNode) |
|
inlineinherited |
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) |
|
inherited |
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) |
|
inherited |
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) |
|
inherited |
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) |
|
inherited |
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) |
|
inlineinherited |
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) |
|
inlineinherited |
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) |
If NULL, just remove from all lists.
|
inlineinherited |
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) |
|
inlineinherited |
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) |
If NULL, just remove from all lists.
|
inlineinherited |
Add ourselves 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) |
|
inlineinherited |
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) |
|
inlineinherited |
Add ourselves 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) |
|
inlineinherited |
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) |
|
overridevirtual |
Check a DListInNode.
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. |
Reimplemented from DListInNode< R, L, s, 2 *n >.
|
staticprivate |
Convert a possible link pointer into an actual link object.
If we are given a non-null pointer, us it, otherwise dynamically create the needed ManyManyLink object, and mark it to be deleted when removed.
|
inlineinherited |
Return pointer to next node on list.
|
inlineinherited |
Return pointer to next node on list.
|
inline |
|
inline |
|
inline |
|
inlineinherited |
Return pointer to previous node on list.
|
inlineinherited |
Return pointer to previous node on list.
|
inline |
|
inline |
|
inlineinherited |
|
inlineinherited |
|
inlineinherited |
|
inlineinherited |
void ManyManyLink< R, N, s, n, L >::remove | ( | ) |
|
inline |
|
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().
|
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().
|
inlineinherited |
|
inlineinherited |
|
inlineinherited |
|
inlineinherited |
|
inlineinherited |
|
inlineinherited |
|
private |
|
privateinherited |
Pointer to net node on list.
|
privateinherited |
Pointer to previous node on list.
|
privateinherited |
Pointer to list we are on.
|
private |
|
private |