Debian Codegraph @

vendor/Heap-Layers/utility/dllist.h

raw symbols SCIP
1 // -*- C++ -*-cxx . . $ `<file>/vendor/Heap-Layers/utility/dllist.h`/
2
3 /*
4
5 Heap Layers: An Extensible Memory Allocation Infrastructure
6
7 Copyright (C) 2000-2020 by Emery Berger
8 http://www.emeryberger.com
9 [email protected]
10
11 Heap Layers is distributed under the terms of the Apache 2.0 license.
12
13 You may obtain a copy of the License at
14 http://www.apache.org/licenses/LICENSE-2.0
15
16 */
17
18 #ifndef HL_DLLIST_H
19 #define HL_DLLIST_Hcxx . . $ `vendor/Heap-Layers/utility/dllist.h:19:9`!
20
21 #include <assert.h>
22
23 /**
24 *
25 * @class DLList
26 * @brief A "memory neutral" (intrusive) doubly-linked list.
27 * @author Emery Berger
28 */
29
30 namespace HLcxx . . $ HL/ {
31
32 class DLListcxx . . $ HL/DLList# {
33 public:
34
35 inline DLListcxx . . $ HL/DLList#DLList(49f6e7a06ebc5aa8).() {
36 clearcxx . . $ HL/DLList#clear(49f6e7a06ebc5aa8).();
37 }
38
39 class Entrycxx . . $ HL/DLList#Entry#;
40
41 /// Clear the list.
42 inline void clearcxx . . $ HL/DLList#clear(49f6e7a06ebc5aa8).() {
43 headcxx . . $ HL/DLList#head..setPrevcxx . . $ HL/DLList#Entry#setPrev(3ed7911e8a68da4c). (&headcxx . . $ HL/DLList#head.);
44 headcxx . . $ HL/DLList#head..setNextcxx . . $ HL/DLList#Entry#setNext(3ed7911e8a68da4c). (&headcxx . . $ HL/DLList#head.);
45 }
46
47 /// Is the list empty?
48 inline bool isEmptycxx . . $ HL/DLList#isEmpty(50ce9a9e25b4a850).() const {
49 return (headcxx . . $ HL/DLList#head..getNextcxx . . $ HL/DLList#Entry#getNext(22924be377c42fb).() == &headcxx . . $ HL/DLList#head.);
50 }
51
52 /// Get the head of the list.
53 inline Entrycxx . . $ HL/DLList#Entry# * getcxx . . $ HL/DLList#get(de2c47dc2dd1d692).() {
54 const Entrycxx . . $ HL/DLList#Entry# * e = headcxx . . $ HL/DLList#head..nextcxx . . $ HL/DLList#Entry#next.;
55 if (e == &headcxx . . $ HL/DLList#head.) {
56 return nullptr;
57 }
58 headcxx . . $ HL/DLList#head..nextcxx . . $ HL/DLList#Entry#next. = e->nextcxx . . $ HL/DLList#Entry#next.;
59 headcxx . . $ HL/DLList#head..nextcxx . . $ HL/DLList#Entry#next.->prevcxx . . $ HL/DLList#Entry#prev. = &headcxx . . $ HL/DLList#head.;
60 return (Entrycxx . . $ HL/DLList#Entry# *) e;
61 }
62
63 /// Remove one item from the list.
64 inline void removecxx . . $ HL/DLList#remove(3ed7911e8a68da4c). (Entrycxx . . $ HL/DLList#Entry# * e) {
65 e->removecxx . . $ HL/DLList#Entry#remove(83f5f38750778ac8).();
66 }
67
68 /// Insert an entry into the head of the list.
69 inline void insertcxx . . $ HL/DLList#insert(3ed7911e8a68da4c). (Entrycxx . . $ HL/DLList#Entry# * e) {
70 e->insertcxx . . $ HL/DLList#Entry#insert(ade09b28bc80656e). (&headcxx . . $ HL/DLList#head., headcxx . . $ HL/DLList#head..nextcxx . . $ HL/DLList#Entry#next.);
71 }
72
73 /// An entry in the list.
74 class Entrycxx . . $ HL/DLList#Entry# {
75 public:
76 // private:
77 inline void setPrevcxx . . $ HL/DLList#Entry#setPrev(3ed7911e8a68da4c). (Entrycxx . . $ HL/DLList#Entry# * p) { assertcxx . . $ `/usr/include/assert.h:50:10`! (p != nullptr); prevcxx . . $ HL/DLList#Entry#prev. = p; }
78 inline void setNextcxx . . $ HL/DLList#Entry#setNext(3ed7911e8a68da4c). (Entrycxx . . $ HL/DLList#Entry# * p) { assertcxx . . $ `/usr/include/assert.h:50:10`! (p != nullptr); nextcxx . . $ HL/DLList#Entry#next. = p; }
79 inline Entrycxx . . $ HL/DLList#Entry# * getPrevcxx . . $ HL/DLList#Entry#getPrev(22924be377c42fb).() const { return prevcxx . . $ HL/DLList#Entry#prev.; }
80 inline Entrycxx . . $ HL/DLList#Entry# * getNextcxx . . $ HL/DLList#Entry#getNext(22924be377c42fb).() const { return nextcxx . . $ HL/DLList#Entry#next.; }
81 inline void removecxx . . $ HL/DLList#Entry#remove(83f5f38750778ac8).() const {
82 prevcxx . . $ HL/DLList#Entry#prev.->setNextcxx . . $ HL/DLList#Entry#setNext(3ed7911e8a68da4c).(nextcxx . . $ HL/DLList#Entry#next.);
83 nextcxx . . $ HL/DLList#Entry#next.->setPrevcxx . . $ HL/DLList#Entry#setPrev(3ed7911e8a68da4c).(prevcxx . . $ HL/DLList#Entry#prev.);
84 }
85 inline void insertcxx . . $ HL/DLList#Entry#insert(ade09b28bc80656e). (Entrycxx . . $ HL/DLList#Entry# * p, Entrycxx . . $ HL/DLList#Entry# * n) {
86 prevcxx . . $ HL/DLList#Entry#prev. = p;
87 nextcxx . . $ HL/DLList#Entry#next. = n;
88 p->setNextcxx . . $ HL/DLList#Entry#setNext(3ed7911e8a68da4c). (this);
89 n->setPrevcxx . . $ HL/DLList#Entry#setPrev(3ed7911e8a68da4c). (this);
90 }
91 Entrycxx . . $ HL/DLList#Entry# * prevcxx . . $ HL/DLList#Entry#prev.;
92 Entrycxx . . $ HL/DLList#Entry# * nextcxx . . $ HL/DLList#Entry#next.;
93 };
94
95
96 private:
97
98 /// The head of the list.
99 Entrycxx . . $ HL/DLList#Entry# headcxx . . $ HL/DLList#head.;
100
101 };
102
103 }
104
105 #endif