59template <
class R,
class N, ContainerThreadSafety s,
int n>
64 flag &= (node !=
nullptr);
65 if (!flag)
return flag;
67 flag &= (mynode->root() ==
this);
68 flag &= (mynode->next() ==
nullptr);
71 flag &= (mynode->root() ==
this);
72 flag &= (mynode->prev() ==
nullptr);
73 while(flag && mynode){
74 flag &= mynode->check();
75 mynode = mynode->next();
78 flag &= (last() ==
nullptr);
92template <
class R,
class N, ContainerThreadSafety s,
int n>
96 Node* mynode = next();
98 flag &= mynode->root() == root();
100 flag &= (
static_cast<Root*
>(root())->last() ==
this);
104 flag &= mynode->root() == root();
106 flag &= (
static_cast<Root*
>(root())->first() ==
this);
109 flag &= next() ==
nullptr;
125template <
class R,
class N, ContainerThreadSafety s,
int n>
127 unsigned save = writeLock(
false);
131 static_cast<Node*
>(m_next)->m_prev = m_prev;
134 static_cast<Root*
>(m_root)->m_last = m_prev;
137 static_cast<Node*
>(m_prev)->m_next = m_next;
139 static_cast<Root*
>(m_root)->m_first = m_next;
145 root->Root::writeUnlock(save);
158template <
class R,
class N, ContainerThreadSafety s,
int n_>
161 unsigned save = writeLock(
false);
162 if (mynode.m_root ==
this) {
180template <
class R,
class N, ContainerThreadSafety s,
int n_>
182 if (node !=
nullptr) remove(*node);
196template<
class R,
class N, ContainerThreadSafety s,
int n_>
198 Node& mynode =
static_cast<Node&
>(node);
200 if (mynode.m_root !=
nullptr) {
204 unsigned save = writeLock(upgrade);
205 mynode.setRoot(
static_cast<R*
>(
this));
206 if (m_first ==
nullptr) {
210 m_first ->Node::m_prev = &node;
212 mynode.m_next = m_first;
213 mynode.m_prev =
nullptr;
228template<
class R,
class N, ContainerThreadSafety s,
int n_>
230 if (node !=
nullptr) addFirst(*node, upgrade);
247template<
class R,
class N, ContainerThreadSafety s,
int n_>
251 if (mynode.m_root !=
nullptr) mynode.remove();
253 unsigned save = writeLock(upgrade);
254 if (m_last ==
nullptr) {
257 mynode.m_prev =
nullptr;
259 mynode.m_prev = m_last;
260 static_cast<Node*
>(m_last)->m_next = &node;
263 mynode.m_next =
nullptr;
264 mynode.setRoot(
static_cast<R*
>(
this));
281template<
class R,
class N, ContainerThreadSafety s,
int n_>
283 if (node !=
nullptr) addLast(*node, upgrade);
302template<
class R,
class N, ContainerThreadSafety s,
int n_>
304 addLast(node, upgrade);
320template<
class R,
class N, ContainerThreadSafety s,
int n_>
322 if (node !=
nullptr) add(*node, upgrade);
334template<
class R,
class N, ContainerThreadSafety s,
int n>
336 static_cast<Root&
>(myRoot).addFirst(*
static_cast<N*
>(
this), upgrade);
349template<
class R,
class N, ContainerThreadSafety s,
int n>
352 static_cast<Root*
>(myRoot)->addFirst(*
static_cast<N*
>(
this), upgrade);
367template<
class R,
class N, ContainerThreadSafety s,
int n>
369 static_cast<Root&
>(myRoot).addLast(*
static_cast<N*
>(
this), upgrade);
384template<
class R,
class N, ContainerThreadSafety s,
int n>
387 static_cast<Root*
>(myRoot)->addLast(*
static_cast<N*
>(
this), upgrade);
403template<
class R,
class N, ContainerThreadSafety s,
int n>
406 N* me =
static_cast<N*
>(
this);
407 if (mynode.m_root && &node != me) {
409 unsigned save = mynode.writeLock(upgrade);
410 setRoot(mynode.m_root);
411 m_next = mynode.m_next;
415 static_cast<Node*
>(m_next)->m_prev = me;
417 static_cast<Root*
>(m_root)->m_last = me;
419 mynode.writeUnlock(save);
434template<
class R,
class N, ContainerThreadSafety s,
int n>
436 if (node !=
nullptr) {
437 addAfter(*node, upgrade);
451template<
class R,
class N, ContainerThreadSafety s,
int n>
453 addToEnd(myRoot, upgrade);
466template<
class R,
class N, ContainerThreadSafety s,
int n>
468 addToEnd(myRoot, upgrade);
483template <
class R,
class N, ContainerThreadSafety s,
int n>
499template <
class R,
class N, ContainerThreadSafety s,
int n>
501 while (m_first) remove(m_first);
513template <
class R,
class N, ContainerThreadSafety s,
int n>
520 if (myRoot)
addTo(myRoot);
532template <
class R,
class N, ContainerThreadSafety s,
int n>
551template <
class R,
class N, ContainerThreadSafety s,
int n>
Intrusive Double Linked List.
Base Container Node Class.
Definition Container.h:255
void addTo(R &root, bool upgrade=false)
Add ourself to a list at "natural" postion.
Definition DListIn.hpp:452
class DListInNode< R, N, s, n > Node
Type of DListIInNode.
Definition DListIn.h:207
bool check() const override
Check a DListInNode.
Definition DListIn.hpp:93
void remove()
Remove node from whatever list it is on, if it is on a list.
Definition DListIn.hpp:126
~DListInNode()
Destructor.
Definition DListIn.hpp:552
class DListInRoot< R, N, s, n > Root
Type of DListInRoot.
Definition DListIn.h:206
void addToFront(R &root, bool upgrade=false)
Add ourselves to the front of a list.
Definition DListIn.hpp:335
void addToEnd(R &root, bool upgrade=false)
Add ourselfs to the end of a list.
Definition DListIn.hpp:368
DListInNode(R *root=nullptr)
Constructor.
Definition DListIn.hpp:514
void addAfter(N &node, bool upgrade=false)
Add ourself to a list after another node.
Definition DListIn.hpp:404
~DListInRoot()
Destructor.
Definition DListIn.hpp:500
void remove(N &node)
Remove Node from List.
Definition DListIn.hpp:159
void add(N &node, bool upgrade=false)
Add node to our list, at "natural" point.
Definition DListIn.hpp:303
bool check() const override
Check a DListInRoot and the list connected.
Definition DListIn.hpp:60
void addFirst(N &node, bool upgrade=false)
Add node to front of our list.
Definition DListIn.hpp:197
void addLast(N &node, bool upgrade=false)
Add node to end of our list.
Definition DListIn.hpp:248
class DListInNode< R, N, s, n > Node
Type of DListIInNode.
Definition DListIn.h:140
DListInRoot()
Constructor.
Definition DListIn.hpp:484