Rudiments: /home/dmuse/src/rudiments/include/rudiments/linkedlist.h Source File

Rudiments

- Main Page
- Classes

linkedlist.h
1 // Copyright (c) 2003 David Muse
2 // See the COPYING file for more information.
3
4 #ifndef RUDIMENTS_LINKEDLIST_H
5 #define RUDIMENTS_LINKEDLIST_H
6
7 #include <rudiments/private/linkedlistincludes.h>
8
10 template <class valuetype>
11 class linkedlistnode {
12 public:
15 linkedlistnode(valuetype value);
16
20 ~linkedlistnode();
21
23 void setValue(valuetype value);
24
26 valuetype getValue() const;
27
31 int32_t compare(valuetype value) const;
32
37 int32_t compare(linkedlistnode<valuetype> *peer) const;
38
41 linkedlistnode<valuetype> *getPrevious();
42
45 linkedlistnode<valuetype> *getNext();
46
48 void print() const;
49
50 #include <rudiments/private/linkedlistnode.h>
51 };
52
59 template < class valuetype >
60 class linkedlist {
61 public:
63 linkedlist();
64
68 ~linkedlist();
69
72 void prepend(valuetype value);
73
76 void prepend(linkedlistnode<valuetype> *node);
77
80 void append(valuetype value);
81
84 void append(linkedlistnode<valuetype> *node);
85
88 void insertBefore(linkedlistnode<valuetype> *node,
89 valuetype value);
90
93 void insertBefore(linkedlistnode<valuetype> *node,
94 linkedlistnode<valuetype> *newnode);
95
98 void insertAfter(linkedlistnode<valuetype> *node,
99 valuetype value);
100
103 void insertAfter(linkedlistnode<valuetype> *node,
104 linkedlistnode<valuetype> *newnode);
105
108 void moveBefore(linkedlistnode<valuetype> *node,
109 linkedlistnode<valuetype> *nodetomove);
110
113 void moveAfter(linkedlistnode<valuetype> *node,
114 linkedlistnode<valuetype> *nodetomove);
115
117 void detach(linkedlistnode<valuetype> *node);
118
125 bool remove(valuetype value);
126
133 bool removeAll(valuetype value);
134
142 bool remove(linkedlistnode<valuetype> *node);
143
145 uint64_t getLength() const;
146
148 linkedlistnode<valuetype> *getFirst();
149
151 linkedlistnode<valuetype> *getLast();
152
156 linkedlistnode<valuetype> *getPrevious(
157 linkedlistnode<valuetype> *node);
158
162 linkedlistnode<valuetype> *getNext(
163 linkedlistnode<valuetype> *node);
164
167 linkedlistnode<valuetype> *find(valuetype value);
168
172 linkedlistnode<valuetype>
173 *find(linkedlistnode<valuetype> *startnode,
174 valuetype value);
175
179 void insertionSort();
180
185 void heapSort();
186
190 void clear();
191
193 void print() const;
194
197 void print(uint64_t count) const;
198
199 #include <rudiments/private/linkedlist.h>
200 };
201
202 #include <rudiments/private/linkedlistinlines.h>
203
204 #endif
linkedlistnode::setValue
void setValue(valuetype value)
linkedlist
Definition: linkedlist.h:60
linkedlistnode::~linkedlistnode
~linkedlistnode()
linkedlistnode::getValue
valuetype getValue() const
linkedlistnode::linkedlistnode
linkedlistnode(valuetype value)
linkedlistnode::getPrevious
linkedlistnode< valuetype > * getPrevious()
linkedlistnode
Definition: linkedlist.h:11
linkedlistnode::compare
int32_t compare(valuetype value) const
linkedlistnode::print
void print() const
linkedlistnode::getNext
linkedlistnode< valuetype > * getNext()