-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSkipListNode.hpp
More file actions
37 lines (30 loc) · 808 Bytes
/
SkipListNode.hpp
File metadata and controls
37 lines (30 loc) · 808 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#ifndef SKIPLISTNODE_HPP
#define SKIPLISTNODE_HPP
#include "entry.hpp"
template <typename K, typename V>
class Node
{
private:
Entry<K, V> entry;
public:
Node<K, V> *succ = nullptr;
Node<K, V> *pred = nullptr;
Node<K, V> *above = nullptr;
Node<K, V> *below = nullptr;
Node(K k, V v) {
this->entry = new Entry<K, V>(k, v);
}
Node(Node* base) {
this->below = base;
base->above = this;
this->entry.key = base->entry.key;
this->entry.val = base->entry.val;
}
~Node() {}
K getKey() const {return entry.key;}
V getVal() const {return entry.val;}
void setKey(K k) {this->entry.key = k;}
void setVal(V v) {this->entry.val = v;}
void setKV(K k, V v) {setKey(k);setVal(v);}
};
#endif // SkipListNode_hpp