-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathFileNodeKey.cpp
68 lines (58 loc) · 1.25 KB
/
FileNodeKey.cpp
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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
/**
*
* @description ChunkTree Key having our entity as payload
**/
#include <string>
#include "ChunkNodeKey.cpp"
#include "BTree.hpp"
namespace AIFBS {
class FileNodeKey
{
std::string m_key;
// entity cd;
//all chunck playload can come here
public:
BTree<ChunkNodeKey> *m_chunkTree;
FileNodeKey() {
m_key = "default-fault";
};
FileNodeKey(std::string t_key, BTree<ChunkNodeKey> *t_chunkTree) {
m_key = t_key;
m_chunkTree = t_chunkTree;
};
~FileNodeKey() {
//delete(m_chunkTree);
};
//Must to overload
bool operator< (const FileNodeKey& other) {
return m_key < other.m_key;
}
bool operator> (const FileNodeKey& other) {
return m_key > other.m_key;
}
bool operator== (const FileNodeKey& other) {
return m_key == other.m_key;
}
void Print( std::ostream& out) {
out<<m_key<<": ";
if(m_chunkTree == NULL) {
out<<"ChunkTree is NULL";
} else {
m_chunkTree->traverse();
}
}
friend std::ostream& operator<<( std::ostream& out, FileNodeKey& b )
{
b.Print( out );
return out;
}
//Overloading Completed
//Getter & Setters
std::string getKey() {
return m_key;
}
void setKey(std::string t_key) {
m_key = t_key;
}
};
}