Rudiments
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>
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 
133  bool removeAll(valuetype value);
134 
142  bool remove(linkedlistnode<valuetype> *node);
143 
145  uint64_t getLength() const;
146 
149 
152 
158 
164 
167  linkedlistnode<valuetype> *find(valuetype value);
168 
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
void setValue(valuetype value)
void detach(linkedlistnode< valuetype > *node)
void clear()
Definition: linkedlist.h:60
valuetype getValue() const
void print() const
linkedlistnode< valuetype > * getPrevious(linkedlistnode< valuetype > *node)
linkedlistnode< valuetype > * getNext(linkedlistnode< valuetype > *node)
void append(valuetype value)
linkedlistnode(valuetype value)
void moveBefore(linkedlistnode< valuetype > *node, linkedlistnode< valuetype > *nodetomove)
linkedlistnode< valuetype > * find(valuetype value)
linkedlistnode< valuetype > * getLast()
linkedlistnode< valuetype > * getPrevious()
Definition: linkedlist.h:11
linkedlistnode< valuetype > * getFirst()
void insertionSort()
int32_t compare(valuetype value) const
void insertAfter(linkedlistnode< valuetype > *node, valuetype value)
void insertBefore(linkedlistnode< valuetype > *node, valuetype value)
void print() const
bool removeAll(valuetype value)
void moveAfter(linkedlistnode< valuetype > *node, linkedlistnode< valuetype > *nodetomove)
linkedlistnode< valuetype > * getNext()
void prepend(valuetype value)
uint64_t getLength() const
void heapSort()