Rudiments
linkedlist.h
1 // Copyright (c) 1999-2018 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>
12  public:
15  linkedlistnode(valuetype value);
16 
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 
42 
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 
77 
80  void append(valuetype value);
81 
85 
89  valuetype value);
90 
94  linkedlistnode<valuetype> *newnode);
95 
99  valuetype value);
100 
104  linkedlistnode<valuetype> *newnode);
105 
109  linkedlistnode<valuetype> *nodetomove);
110 
114  linkedlistnode<valuetype> *nodetomove);
115 
117  void detach(linkedlistnode<valuetype> *node);
118 
125  bool remove(valuetype value);
126 
134  bool removeAndDelete(valuetype value);
135 
144  bool removeAndArrayDelete(valuetype value);
145 
152  bool removeAll(valuetype value);
153 
161  bool removeAllAndDelete(valuetype value);
162 
171  bool removeAllAndArrayDelete(valuetype value);
172 
180  bool remove(linkedlistnode<valuetype> *node);
181 
191 
202 
204  uint64_t getLength() const;
205 
208 
211 
217 
223 
226  linkedlistnode<valuetype> *find(valuetype value);
227 
232  *find(linkedlistnode<valuetype> *startnode,
233  valuetype value);
234 
238  void insertionSort();
239 
244  void heapSort();
245 
249  void clear();
250 
254  void clearAndDelete();
255 
259  void clearAndArrayDelete();
260 
262  void print() const;
263 
266  void print(uint64_t count) const;
267 
268  #include <rudiments/private/linkedlist.h>
269 };
270 
271 #include <rudiments/private/linkedlistinlines.h>
272 
273 #endif
void setValue(valuetype value)
void detach(linkedlistnode< valuetype > *node)
void clear()
bool removeAllAndArrayDelete(valuetype value)
Definition: linkedlist.h:60
void print() const
void print() const
bool removeAndArrayDelete(valuetype value)
linkedlistnode< valuetype > * getPrevious(linkedlistnode< valuetype > *node)
linkedlistnode< valuetype > * getNext(linkedlistnode< valuetype > *node)
uint64_t getLength() const
void append(valuetype value)
linkedlistnode(valuetype value)
void moveBefore(linkedlistnode< valuetype > *node, linkedlistnode< valuetype > *nodetomove)
bool removeAndDelete(valuetype value)
linkedlistnode< valuetype > * find(valuetype value)
linkedlistnode< valuetype > * getLast()
bool remove(valuetype value)
linkedlistnode< valuetype > * getPrevious()
void clearAndArrayDelete()
bool removeAllAndDelete(valuetype value)
Definition: linkedlist.h:11
linkedlistnode< valuetype > * getFirst()
int32_t compare(valuetype value) const
void insertionSort()
void insertAfter(linkedlistnode< valuetype > *node, valuetype value)
void insertBefore(linkedlistnode< valuetype > *node, valuetype value)
void clearAndDelete()
valuetype getValue() const
bool removeAll(valuetype value)
void moveAfter(linkedlistnode< valuetype > *node, linkedlistnode< valuetype > *nodetomove)
linkedlistnode< valuetype > * getNext()
void prepend(valuetype value)
void heapSort()