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

Rudiments

- Main Page
- Classes

singlylinkedlist.h
1 // Copyright (c) 2014 David Muse
2 // See the COPYING file for more information.
3
4 #ifndef RUDIMENTS_SINGLYLINKEDLIST_H
5 #define RUDIMENTS_SINGLYLINKEDLIST_H
6
7 #include <rudiments/private/singlylinkedlistincludes.h>
8
11 template <class valuetype>
12 class singlylinkedlistnode {
13 public:
16 singlylinkedlistnode(valuetype value);
17
21 ~singlylinkedlistnode();
22
24 void setValue(valuetype value);
25
27 valuetype getValue() const;
28
32 int32_t compare(valuetype value) const;
33
38 int32_t compare(singlylinkedlistnode<valuetype> *peer) const;
39
42 singlylinkedlistnode<valuetype> *getNext();
43
45 void print() const;
46
47 #include <rudiments/private/singlylinkedlistnode.h>
48 };
49
63 template < class valuetype >
64 class singlylinkedlist {
65 public:
67 singlylinkedlist();
68
73 ~singlylinkedlist();
74
77 void prepend(valuetype value);
78
81 void prepend(singlylinkedlistnode<valuetype> *node);
82
85 void append(valuetype value);
86
89 void append(singlylinkedlistnode<valuetype> *node);
90
93 void insertAfter(singlylinkedlistnode<valuetype> *node,
94 valuetype value);
95
98 void insertAfter(singlylinkedlistnode<valuetype> *node,
99 singlylinkedlistnode<valuetype> *newnode);
100
107 void moveAfter(singlylinkedlistnode<valuetype> *node,
108 singlylinkedlistnode<valuetype> *nodetomove);
109
115 void detach(singlylinkedlistnode<valuetype> *node);
116
124 bool remove(valuetype value);
125
133 bool removeAll(valuetype value);
134
143 bool remove(singlylinkedlistnode<valuetype> *node);
144
146 uint64_t getLength() const;
147
149 singlylinkedlistnode<valuetype> *getFirst();
150
152 singlylinkedlistnode<valuetype> *getLast();
153
157 singlylinkedlistnode<valuetype> *getNext(
158 singlylinkedlistnode<valuetype> *node);
159
162 singlylinkedlistnode<valuetype> *find(valuetype value);
163
167 singlylinkedlistnode<valuetype>
168 *find(singlylinkedlistnode<valuetype> *startnode,
169 valuetype value);
170
174 void insertionSort();
175
180 void heapSort();
181
185 void clear();
186
188 void print() const;
189
192 void print(uint64_t count) const;
193
194 #include <rudiments/private/singlylinkedlist.h>
195 };
196
197
198 #include <rudiments/private/singlylinkedlistinlines.h>
199
200 #endif
singlylinkedlistnode::getValue
valuetype getValue() const
singlylinkedlistnode::getNext
singlylinkedlistnode< valuetype > * getNext()
singlylinkedlistnode::singlylinkedlistnode
singlylinkedlistnode(valuetype value)
singlylinkedlistnode::print
void print() const
singlylinkedlist
Definition: singlylinkedlist.h:64
singlylinkedlistnode::setValue
void setValue(valuetype value)
singlylinkedlistnode::~singlylinkedlistnode
~singlylinkedlistnode()
singlylinkedlistnode
Definition: singlylinkedlist.h:12
singlylinkedlistnode::compare
int32_t compare(valuetype value) const