58template <
class R,
class N, ContainerThreadSafety s,
int n>
63 flag &= (node !=
nullptr);
64 if (!flag)
return flag;
66 flag &= (mynode->
root() ==
this);
67 flag &= (mynode->
next() ==
nullptr);
70 flag &= (mynode->
root() ==
this);
71 while(flag && mynode){
72 flag &= mynode->
check();
73 mynode = mynode->
next();
76 flag &= (last() ==
nullptr);
89template <
class R,
class N, ContainerThreadSafety s,
int n>
93 Node* mynode = next();
95 flag &= mynode->
root() == root();
97 flag &= (
static_cast<Root*
>(root())->
last() ==
this);
100 flag &= next() ==
nullptr;
112template <
class R,
class N, ContainerThreadSafety s,
int n>
114 unsigned save = readLock(
true);
117 Root* mylist =
static_cast<Root*
>(m_root);
120 unsigned save1 = writeLock(
true);
127 root1->Root::writeUnlock(save1);
132 while (node !=
nullptr) {
134 N* nextNode = mynode->
m_next;
135 if (nextNode ==
this) {
136 unsigned save1 = writeLock(
true);
140 if(m_next ==
nullptr) {
145 root1->Root::writeUnlock(save1);
153 root->Root::readUnlock(save);
166template <
class R,
class N, ContainerThreadSafety s,
int n_>
169 if (mynode.
m_root ==
this) {
186template <
class R,
class N, ContainerThreadSafety s,
int n_>
188 if (node !=
nullptr) remove(*node);
201template<
class R,
class N, ContainerThreadSafety s,
int n_>
206 unsigned save = writeLock(upgrade);
207 mynode.
setRoot(
static_cast<R*
>(
this));
223template<
class R,
class N, ContainerThreadSafety s,
int n_>
225 if (node !=
nullptr) addFirst(*node, upgrade);
239template<
class R,
class N, ContainerThreadSafety s,
int n_>
245 if (!upgrade) save = readLock(
false);
248 unsigned save1 = writeLock(upgrade);
249 if (m_last ==
nullptr) {
253 static_cast<Node*
>(m_last)->m_next = &node;
256 mynode.
setRoot(
static_cast<R*
>(
this));
259 if (!upgrade) readUnlock(save);
274template<
class R,
class N, ContainerThreadSafety s,
int n_>
276 if (node !=
nullptr) addLast(*node, upgrade);
292template<
class R,
class N, ContainerThreadSafety s,
int n_>
294 addFirst(node, upgrade);
311template<
class R,
class N, ContainerThreadSafety s,
int n_>
313 if (node !=
nullptr) add(*node, upgrade);
326template<
class R,
class N, ContainerThreadSafety s,
int n>
328 static_cast<Root&
>(myRoot).addFirst(*
static_cast<N*
>(
this), upgrade);
342template<
class R,
class N, ContainerThreadSafety s,
int n>
345 static_cast<Root*
>(myRoot)->addFirst(*
static_cast<N*
>(
this), upgrade);
361template<
class R,
class N, ContainerThreadSafety s,
int n>
363 static_cast<Root&
>(myRoot).addLast(*
static_cast<N*
>(
this), upgrade);
378template<
class R,
class N, ContainerThreadSafety s,
int n>
381 static_cast<Root*
>(myRoot)->addLast(*
static_cast<N*
>(
this), upgrade);
399template<
class R,
class N, ContainerThreadSafety s,
int n>
402 N* me =
static_cast<N*
>(
this);
403 if (mynode.
m_root && &node != me) {
405 unsigned save = mynode.
writeLock(upgrade);
425template<
class R,
class N, ContainerThreadSafety s,
int n>
427 if (node !=
nullptr) {
428 addAfter(*node, upgrade);
443template<
class R,
class N, ContainerThreadSafety s,
int n>
445 addToFront(myRoot, upgrade);
459template<
class R,
class N, ContainerThreadSafety s,
int n>
461 addToFront(myRoot, upgrade);
474template <
class R,
class N, ContainerThreadSafety s,
int n>
487template <
class R,
class N, ContainerThreadSafety s,
int n>
489 while (m_first) remove(m_first);
501template <
class R,
class N, ContainerThreadSafety s,
int n>
506 if (myRoot)
addTo(myRoot);
518template <
class R,
class N, ContainerThreadSafety s,
int n>
535template <
class R,
class N, ContainerThreadSafety s,
int n>
Intrusive Singly Linked List.
Base Container Node Class.
Definition Container.h:255
Intrusive Singly Linked List, Node.
Definition ListIn.h:194
void setRoot(R *root)
Definition ListIn.h:216
void writeUnlock(unsigned save) const
Definition ListIn.h:222
N * m_next
Pointer to next Node in list.
Definition ListIn.h:230
void addTo(R &myRoot, bool upgrade=false)
Add ourself to a list at "natural" postion.
Definition ListIn.hpp:444
void addAfter(N &myNode, bool upgrade=false)
Add ourself to a list after another node.
Definition ListIn.hpp:400
ListInNode(R &myRoot)
Constructor.
Definition ListIn.hpp:519
void addToEnd(R &myRoot, bool upgrade=false)
Add ourselfs to the end of a list.
Definition ListIn.hpp:362
R * root() const
Return pointer to List we are on.
Definition ListIn.h:214
R * m_root
Pointer to list we are on.
Definition ListIn.h:229
void addToFront(R &myRoot, bool upgrade=false)
Add ourselfs to the front of a list.
Definition ListIn.hpp:327
void remove()
Remove node from whatever list it is on, if it is on a list.
Definition ListIn.hpp:113
bool check() const override
Definition ListIn.hpp:90
N * next() const
Return pointer to next Node on List.
Definition ListIn.h:215
~ListInNode()
Destructor.
Definition ListIn.hpp:536
unsigned writeLock(bool upgrade) const
Definition ListIn.h:221
Intrusive Singly Linked List, List.
Definition ListIn.h:131
void remove(N &node)
Remove Node from List.
Definition ListIn.hpp:167
void addFirst(N &node, bool upgrade=false)
Add node to front of our list.
Definition ListIn.hpp:202
void add(N &node, bool upgrade=false)
Add node to our list, at "natural" point.
Definition ListIn.hpp:293
N * last() const
Return pointer to last Node on list.
Definition ListIn.h:149
ListInRoot()
Constructor.
Definition ListIn.hpp:475
N * m_first
Pointer to first Node on list.
Definition ListIn.h:161
bool check() const override
Definition ListIn.hpp:59
void addLast(N &node, bool upgrade=false)
Add node to end of our list.
Definition ListIn.hpp:240
~ListInRoot()
Destructor.
Definition ListIn.hpp:488
N * m_last
Pointer to last Node on list.
Definition ListIn.h:162