Rudiments
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>
13  public:
16  singlylinkedlistnode(valuetype value);
17 
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 
43 
45  void print() const;
46 
47  #include <rudiments/private/singlylinkedlistnode.h>
48 };
49 
63 template < class valuetype >
65  public:
68 
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,
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 
150 
153 
159 
162  singlylinkedlistnode<valuetype> *find(valuetype value);
163 
168  *find(singlylinkedlistnode<valuetype> *startnode,
169  valuetype value);
170 
174  void insertionSort();
175 
180  void heapSort();
181 
185  void clear();
186 
190  void clearAndDelete();
191 
196  void clearAndArrayDelete();
197 
199  void print() const;
200 
203  void print(uint64_t count) const;
204 
205  #include <rudiments/private/singlylinkedlist.h>
206 };
207 
208 
209 #include <rudiments/private/singlylinkedlistinlines.h>
210 
211 #endif
singlylinkedlistnode< valuetype > * getNext()
singlylinkedlistnode(valuetype value)
int32_t compare(valuetype value) const
Definition: singlylinkedlist.h:64
void setValue(valuetype value)
valuetype getValue() const
Definition: singlylinkedlist.h:12
void print() const