Intrusive Containers
Loading...
Searching...
No Matches
DListIn.hpp
Go to the documentation of this file.
1#ifndef DListIn_HPP
2#define DListIn_HPP
3
4/**
5 @file DListIn.hpp
6 @brief Intrusive Double Linked List, Implementation.
7
8 This file defines the implementation for a pair of templates (DListInRoot and DListInNode) that
9 implement an intrusive double linked list.
10
11@copyright (c) 2014-2024 Richard Damon
12@parblock
13MIT License:
14
15Permission is hereby granted, free of charge, to any person obtaining a copy
16of this software and associated documentation files (the "Software"), to deal
17in the Software without restriction, including without limitation the rights
18to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
19copies of the Software, and to permit persons to whom the Software is
20furnished to do so, subject to the following conditions:
21
22The above copyright notice and this permission notice shall be included in
23all copies or substantial portions of the Software.
24
25THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
26IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
27FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
28AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
29LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
30OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
31THE SOFTWARE.
32@endparblock
33
34@see DListIn.h
35@see ListIn.h
36@ingroup IntrusiveContainers
37*/
38
39#include "DListIn.h"
40
41/******************************************************************************************
42Implementation
43
44Note that when we need to convert a List or Node pointer/reference to a DListInRoot/ListInNode
45pointer/reference we need to do an explicit static_cast, to avoid ambiquity in the case of
46classes deriving from multiple versions of DListInRoot/ListInNode
47*/
48
49/**
50 * Check a DListInRoot and the list connected
51 *
52 * @tparam R The class that will be the owner of the Tree. Must derive from TreeInRoot<R, N, K, n>
53 * @tparam N The class that will be the nodes of the Tree. Must derive from TreeInNode<R, N, K, n>
54 * @tparam s The ContainerThreadSafety value to define the thread safety model of the Container
55 * @tparam n A numerical parameter to allow a give List/Node combination to have multiple list-node relationships. Defaults to 0 if not provided.
56 * @return true if check passes
57 */
58
59template <class R, class N, ContainerThreadSafety s, int n>
61 bool flag = true;
62 if (first()) {
63 N* node = last();
64 flag &= (node != nullptr); // if have first, must have last
65 if (!flag) return flag;
66 Node* mynode = node;
67 flag &= (mynode->root() == this); // last must point to us
68 flag &= (mynode->next() == nullptr); // last must not point to more
69 node = first();
70 mynode = node;
71 flag &= (mynode->root() == this); // first must point to us
72 flag &= (mynode->prev() == nullptr); // first must not have a previous
73 while(flag && mynode){
74 flag &= mynode->check(); // check all the nodes on the list
75 mynode = mynode->next();
76 }
77 } else {
78 flag &= (last() == nullptr); // if no first, then no last either.
79 }
80 return flag;
81}
82
83/**
84 * Check a DListInNode
85 *
86 * @tparam R The class that will be the owner of the Tree. Must derive from TreeInRoot<R, N, K, n>
87 * @tparam N The class that will be the nodes of the Tree. Must derive from TreeInNode<R, N, K, n>
88 * @tparam s The ContainerThreadSafety value to define the thread safety model of the Container
89 * @tparam n A numerical parameter to allow a give List/Node combination to have multiple list-node relationships. Defaults to 0 if not provided.
90 * @return true if check passes
91 */
92template <class R, class N, ContainerThreadSafety s, int n>
94 bool flag = true;
95 if (root()) {
96 Node* mynode = next();
97 if (mynode) {
98 flag &= mynode->root() == root(); // next must have the same root
99 } else {
100 flag &= (static_cast<Root*>(root())->last() == this); // last in chain, so verify pointed to by root
101 }
102 mynode = prev();
103 if (mynode) {
104 flag &= mynode->root() == root(); // previous must have same root
105 } else {
106 flag &= (static_cast<Root*>(root())->first() == this); // first in chian, verify pointed to by root
107 }
108 } else {
109 flag &= next() == nullptr; // no root, so we must be unattached
110 }
111 return flag;
112}
113
114
115
116/**
117 * Remove node from whatever list it is on, if it is on a list.
118 *
119 * @tparam R The class that will be the owner of the Tree. Must derive from TreeInRoot<R, N, K, n>
120 * @tparam N The class that will be the nodes of the Tree. Must derive from TreeInNode<R, N, K, n>
121 * @tparam s The ContainerThreadSafety value to define the thread safety model of the Container
122 * @tparam n A numerical parameter to allow a give List/Node combination to have multiple list-node relationships. Defaults to 0 if not provided.
123*/
124
125template <class R, class N, ContainerThreadSafety s, int n>
127 unsigned save = writeLock(false);
128 R* root = m_root;
129 if (m_root) {
130 if (m_next) { // if someone after us, update their back pointer
131 static_cast<Node*>(m_next)->m_prev = m_prev;
132 } else {
133 // Else update end of list pointer
134 static_cast<Root*>(m_root)->m_last = m_prev;
135 }
136 if (m_prev) { // if someone before us, update their next pointer
137 static_cast<Node*>(m_prev)->m_next = m_next;
138 } else { // if no one before us update list head
139 static_cast<Root*>(m_root)->m_first = m_next;
140 }
141 m_next = nullptr;
142 m_prev = nullptr;
143 setRoot(nullptr);
144 }
145 root->Root::writeUnlock(save);
148/**
149 * Remove Node from List
150 * @tparam R The class that will be the owner of the Tree. Must derive from TreeInRoot<R, N, K, n>
151 * @tparam N The class that will be the nodes of the Tree. Must derive from TreeInNode<R, N, K, n>
152 * @tparam s The ContainerThreadSafety value to define the thread safety model of the Container
153 * @tparam n A numerical parameter to allow a give List/Node combination to have multiple list-node relationships. Defaults to 0 if not provided.
154 * @param node node to be removed.
155 *
156 * If node is not on this list, nothing will be done.
158template <class R, class N, ContainerThreadSafety s, int n_>
160 Node& mynode = node;
161 unsigned save = writeLock(false);
162 if (mynode.m_root == this) {
163 // Only remove if node is on this list.
164 mynode.remove();
165 }
166 writeUnlock(save);
167}
168
169
170/**
171 * Remove Node from List
172 * @tparam R The class that will be the owner of the Tree. Must derive from TreeInRoot<R, N, K, n>
173 * @tparam N The class that will be the nodes of the Tree. Must derive from TreeInNode<R, N, K, n>
174 * @tparam s The ContainerThreadSafety value to define the thread safety model of the Container
175 * @tparam n A numerical parameter to allow a give List/Node combination to have multiple list-node relationships. Defaults to 0 if not provided.
176 * @param node Pointer to node to be removed.
177 * If node is null, operation will be ignored.
178 * If node is not on this list, nothing will be done.
179*/
180template <class R, class N, ContainerThreadSafety s, int n_>
182 if (node != nullptr) remove(*node);
183}
184
185/**
186 * Add node to front of our list.
187 *
188 * @tparam R The class that will be the owner of the Tree. Must derive from TreeInRoot<R, N, K, n>
189 * @tparam N The class that will be the nodes of the Tree. Must derive from TreeInNode<R, N, K, n>
190 * @tparam s The ContainerThreadSafety value to define the thread safety model of the Container
191 * @tparam n A numerical parameter to allow a give List/Node combination to have multiple list-node relationships. Defaults to 0 if not provided.
192 * @param node The node to add to the list
193 * If node is currently on a list (even us) it is removed before being added to the list
194 * @param upgrade Set True if caller has an upgradable Read Lock (Used by SortDListInRoot)
195*/
196template<class R, class N, ContainerThreadSafety s, int n_>
197inline void DListInRoot<R, N, s, n_>::addFirst(N& node, bool upgrade) {
198 Node& mynode = static_cast<Node&>(node);
199
200 if (mynode.m_root != nullptr) {
201 mynode.remove();
202 }
203
204 unsigned save = writeLock(upgrade);
205 mynode.setRoot(static_cast<R*>(this));
206 if (m_first == nullptr) {
207 // Empty list, point tail pointer too.
208 m_last = &node;
209 } else {
210 m_first ->Node::m_prev = &node;
212 mynode.m_next = m_first;
213 mynode.m_prev = nullptr;
214 m_first = &node;
215 writeUnlock(save);
218/**
219Add node to front of our list.
220 * @tparam R The class that will be the owner of the Tree. Must derive from TreeInRoot<R, N, K, n>
221 * @tparam N The class that will be the nodes of the Tree. Must derive from TreeInNode<R, N, K, n>
222 * @tparam s The ContainerThreadSafety value to define the thread safety model of the Container
223 * @tparam n A numerical parameter to allow a give List/Node combination to have multiple list-node relationships. Defaults to 0 if not provided.
224 * @param node The node to add to the list
225 * If node is currently on a list (even us) it is removed before being added to the list
226 * @param upgrade Set True if caller has an upgradable Read Lock (Used by SortDListInRoot)
228template<class R, class N, ContainerThreadSafety s, int n_>
229inline void DListInRoot<R, N, s, n_>::addFirst(N* node, bool upgrade) {
230 if (node != nullptr) addFirst(*node, upgrade);
231}
232
233/**
234 * Add node to end of our list.
235 *
236 * Note that this operation is O(n) on list current size. See DListInRoot to make this O(1).
237 *
238 * @tparam R The class that will be the owner of the Tree. Must derive from TreeInRoot<R, N, K, n>
239 * @tparam N The class that will be the nodes of the Tree. Must derive from TreeInNode<R, N, K, n>
240 * @tparam s The ContainerThreadSafety value to define the thread safety model of the Container
241 * @tparam n A numerical parameter to allow a give List/Node combination to have multiple list-node relationships. Defaults to 0 if not provided.
242 * @param node The node to add to the list
243 * If node is currently on a list (even us) it is removed before being added to the list
244 * @param upgrade Set True if caller has an upgradable Read Lock (Used by SortDListInRoot)
245*/
246
247template<class R, class N, ContainerThreadSafety s, int n_>
248inline void DListInRoot<R, N, s, n_>::addLast(N& node, bool upgrade) {
249 Node& mynode = node;
250
251 if (mynode.m_root != nullptr) mynode.remove();
252
253 unsigned save = writeLock(upgrade);
254 if (m_last == nullptr) {
255 // Empty List
256 m_first = &node;
257 mynode.m_prev = nullptr;
258 } else {
259 mynode.m_prev = m_last;
260 static_cast<Node*>(m_last)->m_next = &node;
261 }
262 m_last = &node;
263 mynode.m_next = nullptr;
264 mynode.setRoot(static_cast<R*>(this));
265 writeUnlock(save);
266}
267
268/**
269 * Add node to end of our list.
270 *
271 * Note that this operation is O(n) on list current size. See DListInRoot to make this O(1).
272 * @tparam R The class that will be the owner of the Tree. Must derive from TreeInRoot<R, N, K, n>
273 * @tparam N The class that will be the nodes of the Tree. Must derive from TreeInNode<R, N, K, n>
274 * @tparam s The ContainerThreadSafety value to define the thread safety model of the Container
275 * @tparam n A numerical parameter to allow a give List/Node combination to have multiple list-node relationships. Defaults to 0 if not provided.
276 * @param node The node to add to the list
277 * If node is currently on a list (even us) it is removed before being added to the list
278 * @param upgrade Set True if caller has an upgradable Read Lock (Used by SortDListInRoot)
279*/
280
281template<class R, class N, ContainerThreadSafety s, int n_>
282inline void DListInRoot<R, N, s, n_>::addLast(N* node, bool upgrade) {
283 if (node != nullptr) addLast(*node, upgrade);
284}
285
286
287
288/**
289 * Add node to our list, at "natural" point.
290 * Note that this is the front for singly linked lists and the end for doubly linked list.
291 *
292 * If node is currently on a list (even us) it is removed before being added to the list
293 *
294 * @tparam R The class that will be the owner of the Tree. Must derive from TreeInRoot<R, N, K, n>
295 * @tparam N The class that will be the nodes of the Tree. Must derive from TreeInNode<R, N, K, n>
296 * @tparam s The ContainerThreadSafety value to define the thread safety model of the Container
297 * @tparam n A numerical parameter to allow a give List/Node combination to have multiple list-node relationships. Defaults to 0 if not provided.
298 * @param node The node to add to the list
299 * @param upgrade Set True if caller has an upgradable Read Lock (Used by SortDListInNode)
300 *
301*/
302template<class R, class N, ContainerThreadSafety s, int n_>
303inline void DListInRoot<R, N, s, n_>::add(N& node, bool upgrade) {
304 addLast(node, upgrade);
305}
306
307/**
308 * Add node to our list, at "natural" point.
309 *
310 * Note that this is the front for singly linked lists and the end for doubly linked lists.
311 * @tparam R The class that will be the owner of the Tree. Must derive from TreeInRoot<R, N, K, n>
312 * @tparam N The class that will be the nodes of the Tree. Must derive from TreeInNode<R, N, K, n>
313 * @tparam s The ContainerThreadSafety value to define the thread safety model of the Container
314 * @tparam n A numerical parameter to allow a give List/Node combination to have multiple list-node relationships. Defaults to 0 if not provided.
315 * @param node The node to add to the list
316 * If node is nulR, Nothing is done.
317 * If node is currently on a list (even us) it is removed before being added to the list
318 * @param upgrade Set True if caller has an upgradable Read Lock (Used by SortDListInNode)
319*/
320template<class R, class N, ContainerThreadSafety s, int n_>
321inline void DListInRoot<R, N, s, n_>::add(N* node, bool upgrade) {
322 if (node != nullptr) add(*node, upgrade);
323}
324
325/**
326 * Add ourselves to the front of a list
327 * @tparam R The class that will be the owner of the Tree. Must derive from TreeInRoot<R, N, K, n>
328 * @tparam N The class that will be the nodes of the Tree. Must derive from TreeInNode<R, N, K, n>
329 * @tparam s The ContainerThreadSafety value to define the thread safety model of the Container
330 * @tparam n A numerical parameter to allow a give List/Node combination to have multiple list-node relationships. Defaults to 0 if not provided.
331 * @param myRoot List to add to.
332 * @param upgrade Set True if caller has an upgradable Read Lock (Used by SortDListInNode)
333*/
334template<class R, class N, ContainerThreadSafety s, int n>
335inline void DListInNode<R, N, s, n>::addToFront(R& myRoot, bool upgrade) {
336 static_cast<Root&>(myRoot).addFirst(*static_cast<N*>(this), upgrade);
337}
338
339/**
340Add ourselfs to the front of a list
341 * @tparam R The class that will be the owner of the Tree. Must derive from TreeInRoot<R, N, K, n>
342 * @tparam N The class that will be the nodes of the Tree. Must derive from TreeInNode<R, N, K, n>
343 * @tparam s The ContainerThreadSafety value to define the thread safety model of the Container
344 * @tparam n A numerical parameter to allow a give List/Node combination to have multiple list-node relationships. Defaults to 0 if not provided.
345 * @param myRoot List to add to.
346 * If NULL, just remove from all lists.
347 * @param upgrade Set True if caller has an upgradable Read Lock (Used by SortDListInNode)
348*/
349template<class R, class N, ContainerThreadSafety s, int n>
350inline void DListInNode<R, N, s, n>::addToFront(R* myRoot, bool upgrade) {
351 if (myRoot) {
352 static_cast<Root*>(myRoot)->addFirst(*static_cast<N*>(this), upgrade);
353 } else {
354 remove();
355 }
356}
357
358/**
359Add ourselfs to the end of a list
360 * @tparam R The class that will be the owner of the Tree. Must derive from TreeInRoot<R, N, K, n>
361 * @tparam N The class that will be the nodes of the Tree. Must derive from TreeInNode<R, N, K, n>
362 * @tparam s The ContainerThreadSafety value to define the thread safety model of the Container
363 * @tparam n A numerical parameter to allow a give List/Node combination to have multiple list-node relationships. Defaults to 0 if not provided.
364 * @param myRoot List to add to.
365 * @param upgrade Set True if caller has an upgradable Read Lock (Used by SortDListInNode)
366*/
367template<class R, class N, ContainerThreadSafety s, int n>
368inline void DListInNode<R, N, s, n>::addToEnd(R& myRoot, bool upgrade) {
369 static_cast<Root&>(myRoot).addLast(*static_cast<N*>(this), upgrade);
370}
371
372
373/**
374Add ourselfs to the End of a list
375 * @tparam R The class that will be the owner of the Tree. Must derive from TreeInRoot<R, N, K, n>
376 * @tparam N The class that will be the nodes of the Tree. Must derive from TreeInNode<R, N, K, n>
377 * @tparam s The ContainerThreadSafety value to define the thread safety model of the Container
378 * @tparam n A numerical parameter to allow a give List/Node combination to have multiple list-node relationships. Defaults to 0 if not provided.
379 * @param myRoot List to add to.
380 * @param upgrade Set True if caller has an upgradable Read Lock (Used by SortDListInNode)
381
382If NULL, just remove from all lists.
383*/
384template<class R, class N, ContainerThreadSafety s, int n>
385inline void DListInNode<R, N, s, n>::addToEnd(R* myRoot, bool upgrade) {
386 if (myRoot) {
387 static_cast<Root*>(myRoot)->addLast(*static_cast<N*>(this), upgrade);
388 } else {
389 remove();
390 }
391}
392
393/**
394Add ourself to a list after another node.
395 * @tparam R The class that will be the owner of the Tree. Must derive from TreeInRoot<R, N, K, n>
396 * @tparam N The class that will be the nodes of the Tree. Must derive from TreeInNode<R, N, K, n>
397 * @tparam s The ContainerThreadSafety value to define the thread safety model of the Container
398 * @tparam n A numerical parameter to allow a give List/Node combination to have multiple list-node relationships. Defaults to 0 if not provided.
399 * @param node The node to add ourself after. If that node is not on a list, do nothing.
400 * @param upgrade Set True if caller has an upgradable Read Lock (Used by SortDListInNode)
401*/
402
403template<class R, class N, ContainerThreadSafety s, int n>
404inline void DListInNode<R, N, s, n>::addAfter(N& node, bool upgrade) {
405 Node &mynode = node;
406 N* me = static_cast<N*>(this);
407 if (mynode.m_root && &node != me) {
408 remove();
409 unsigned save = mynode.writeLock(upgrade);
410 setRoot(mynode.m_root);
411 m_next = mynode.m_next;
412 m_prev = &node;
413 mynode.m_next = me;
414 if (m_next) {
415 static_cast<Node*>(m_next)->m_prev = me;
416 } else {
417 static_cast<Root*>(m_root)->m_last = me;
418 }
419 mynode.writeUnlock(save);
420 }
421}
422
423/**
424Add ourself to a list after another node.
425 * @tparam R The class that will be the owner of the Tree. Must derive from TreeInRoot<R, N, K, n>
426 * @tparam N The class that will be the nodes of the Tree. Must derive from TreeInNode<R, N, K, n>
427 * @tparam s The ContainerThreadSafety value to define the thread safety model of the Container
428 * @tparam n A numerical parameter to allow a give List/Node combination to have multiple list-node relationships. Defaults to 0 if not provided.
429 * @param node The node to add ourself after.
430 * If Node is NULL, or not on a list, do nothing.
431 * @param upgrade Set True if caller has an upgradable Read Lock (Used by SortDListInNode)
432*/
433
434template<class R, class N, ContainerThreadSafety s, int n>
435inline void DListInNode<R, N, s, n>::addAfter(N* node, bool upgrade) {
436 if (node != nullptr) {
437 addAfter(*node, upgrade);
438 }
439}
440
441/**
442Add ourself to a list at "natural" postion.
443Note that this is the front for singly linked lists, and the end for doubly linked lists.
444 * @tparam R The class that will be the owner of the Tree. Must derive from TreeInRoot<R, N, K, n>
445 * @tparam N The class that will be the nodes of the Tree. Must derive from TreeInNode<R, N, K, n>
446 * @tparam s The ContainerThreadSafety value to define the thread safety model of the Container
447 * @tparam n A numerical parameter to allow a give List/Node combination to have multiple list-node relationships. Defaults to 0 if not provided.
448 * @param myRoot List to add to.
449 * @param upgrade Set True if caller has an upgradable Read Lock (Used by SortDListInNode)
450*/
451template<class R, class N, ContainerThreadSafety s, int n>
452void DListInNode<R, N, s, n>::addTo(R& myRoot, bool upgrade) {
453 addToEnd(myRoot, upgrade);
454}
455
456/**
457Add ourself to a list at "natural" postion.
458Note that this is the front for singly linked lists, and the end for doubly linked lists.
459 * @tparam R The class that will be the owner of the Tree. Must derive from TreeInRoot<R, N, K, n>
460 * @tparam N The class that will be the nodes of the Tree. Must derive from TreeInNode<R, N, K, n>
461 * @tparam s The ContainerThreadSafety value to define the thread safety model of the Container
462 * @tparam n A numerical parameter to allow a give List/Node combination to have multiple list-node relationships. Defaults to 0 if not provided.
463 * @param myRoot List to add to.
464 * @param upgrade Set True if caller has an upgradable Read Lock (Used by SortDListInNode)
465*/
466template<class R, class N, ContainerThreadSafety s, int n>
467void DListInNode<R, N, s, n>::addTo(R* myRoot, bool upgrade) {
468 addToEnd(myRoot, upgrade);
469}
470
471
472/**
473Constructor.
474
475Starts us as an empty list.
476
477 * @tparam R The class that will be the owner of the Tree. Must derive from TreeInRoot<R, N, K, n>
478 * @tparam N The class that will be the nodes of the Tree. Must derive from TreeInNode<R, N, K, n>
479 * @tparam s The ContainerThreadSafety value to define the thread safety model of the Container
480 * @tparam n A numerical parameter to allow a give List/Node combination to have multiple list-node relationships. Defaults to 0 if not provided.
481
482*/
483template <class R, class N, ContainerThreadSafety s, int n>
485m_first(nullptr),
486m_last(nullptr)
487{}
488
489/**
490Destructor.
491
492Removes all nodes attached to us.
493 * @tparam R The class that will be the owner of the Tree. Must derive from TreeInRoot<R, N, K, n>
494 * @tparam N The class that will be the nodes of the Tree. Must derive from TreeInNode<R, N, K, n>
495 * @tparam s The ContainerThreadSafety value to define the thread safety model of the Container
496 * @tparam n A numerical parameter to allow a give List/Node combination to have multiple list-node relationships. Defaults to 0 if not provided.
497
498*/
499template <class R, class N, ContainerThreadSafety s, int n>
501 while (m_first) remove(m_first);
502}
503
504/**
505Constructor.
506 * @tparam R The class that will be the owner of the Tree. Must derive from TreeInRoot<R, N, K, n>
507 * @tparam N The class that will be the nodes of the Tree. Must derive from TreeInNode<R, N, K, n>
508 * @tparam s The ContainerThreadSafety value to define the thread safety model of the Container
509 * @tparam n A numerical parameter to allow a give List/Node combination to have multiple list-node relationships. Defaults to 0 if not provided.
510
511@param myRoot Pointer to list for node to be added to (if not NULL).
512*/
513template <class R, class N, ContainerThreadSafety s, int n>
515ContainerNode<s>(nullptr),
516m_root(nullptr),
517m_prev(nullptr),
518m_next(nullptr)
519{
520 if (myRoot) addTo(myRoot);
521}
522
523/**
524Constructor.
525 * @tparam R The class that will be the owner of the Tree. Must derive from TreeInRoot<R, N, K, n>
526 * @tparam N The class that will be the nodes of the Tree. Must derive from TreeInNode<R, N, K, n>
527 * @tparam s The ContainerThreadSafety value to define the thread safety model of the Container
528 * @tparam n A numerical parameter to allow a give List/Node combination to have multiple list-node relationships. Defaults to 0 if not provided.
529
530@param myRoot list we are to be added to.
531*/
532template <class R, class N, ContainerThreadSafety s, int n>
534m_root(0),
535m_prev(0),
536m_next(0)
537{
538 addTo(myRoot);
539}
540
541/**
542 * Destructor.
543 *
544 * Remove us from list we are on, if any.
545 *
546 * @tparam R The class that will be the owner of the Tree. Must derive from TreeInRoot<R, N, K, n>
547 * @tparam N The class that will be the nodes of the Tree. Must derive from TreeInNode<R, N, K, n>
548 * @tparam s The ContainerThreadSafety value to define the thread safety model of the Container
549 * @tparam n A numerical parameter to allow a give List/Node combination to have multiple list-node relationships. Defaults to 0 if not provided.
550*/
551template <class R, class N, ContainerThreadSafety s, int n>
555
556#endif
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