Data Structures in C++
Node.hpp
Go to the documentation of this file.
1 /**
2  * @author Douglas De Rizzo Meneghetti (douglasrizzom@gmail.com)
3  * @date 2017-6-8
4  * @brief Node used inside other data structures
5  */
6 
7 #ifndef AULA1_NODE_HPP
8 #define AULA1_NODE_HPP
9 
10 #include <stddef.h>
11 
12 //! Node used inside other data structures. Uses templates to allow storing any kind of object.
13 //! \tparam T the type of object the node will store.
14 template<class T>
15 class Node {
16  private:
17  T value;
20  public:
21 
22  Node() {
23  next = previous = NULL;
24  }
25 
26  ~Node() {
27 // delete next;
28 // delete previous;
29  }
30 
31  T getValue() const {
32  return value;
33  }
34 
35  void setValue(T value) {
36  this->value = value;
37  }
38 
39  Node *getNext() const {
40  return next;
41  }
42 
43  void setNext(Node *next) {
44  this->next = next;
45  }
46 
47  Node *getPrevious() const {
48  return previous;
49  }
50 
51  void setPrevious(Node *previous) {
52  this->previous = previous;
53  }
54 };
55 
56 #endif
Node used inside other data structures.
Definition: Node.hpp:15
void setPrevious(Node *previous)
Definition: Node.hpp:51
Node()
Definition: Node.hpp:22
Node * next
Definition: Node.hpp:18
Node * previous
Definition: Node.hpp:19
void setValue(T value)
Definition: Node.hpp:35
Node * getPrevious() const
Definition: Node.hpp:47
void setNext(Node *next)
Definition: Node.hpp:43
T getValue() const
Definition: Node.hpp:31
~Node()
Definition: Node.hpp:26
Node * getNext() const
Definition: Node.hpp:39
T value
Definition: Node.hpp:17