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 
21  virtual ~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 
43 
45  void print() const;
46 
47  #include <rudiments/private/singlylinkedlistnode.h>
48 };
49 
63 template < class valuetype >
65  public:
68 
73  virtual ~singlylinkedlist();
74 
77  void prepend(valuetype value);
78 
82 
85  void append(valuetype value);
86 
90 
94  valuetype value);
95 
100 
108  singlylinkedlistnode<valuetype> *nodetomove);
109 
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 
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
valuetype getValue() const
singlylinkedlistnode< valuetype > * getNext()
singlylinkedlistnode(valuetype value)
singlylinkedlistnode< valuetype > * getNext(singlylinkedlistnode< valuetype > *node)
void print() const
void print() const
void append(valuetype value)
bool removeAll(valuetype value)
uint64_t getLength() const
Definition: singlylinkedlist.h:64
singlylinkedlistnode< valuetype > * getFirst()
singlylinkedlistnode< valuetype > * find(valuetype value)
void setValue(valuetype value)
void prepend(valuetype value)
void moveAfter(singlylinkedlistnode< valuetype > *node, singlylinkedlistnode< valuetype > *nodetomove)
virtual ~singlylinkedlist()
Definition: singlylinkedlist.h:12
void detach(singlylinkedlistnode< valuetype > *node)
int32_t compare(valuetype value) const
void insertAfter(singlylinkedlistnode< valuetype > *node, valuetype value)
virtual ~singlylinkedlistnode()
singlylinkedlistnode< valuetype > * getLast()