-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathTag.h
63 lines (53 loc) · 1.33 KB
/
Tag.h
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
#ifndef TAG_H
#define TAG_H
using namespace std;
#include <stdint.h>
#define INPUT_SIZE 20
#define HASH_SIZE 32
class Tag
{
public:
//Hash Values
void genHash(uint8_t *key);
void genSubHash(uint8_t *key);
bool compareRHash(Tag interest);
uint8_t getAttrHash(int);
uint8_t getValHash(int);
uint8_t getRHash(int);
string getR();
//Search Functionality
bool operator==(const Tag &other);
void matched();
bool isMatch();
bool isReal();
//Constructor Methods
Tag(const char *, const char *, bool = true, bool = true, char = '=');
Tag(uint8_t *, uint8_t *, bool = true, uint8_t * = {}, string = "");
Tag();
//Deconstructor
~Tag();
//Copy Constructor and Assignment
Tag(const Tag &other);
Tag &operator=(const Tag &other);
//Move Constructor and Assignment
Tag(Tag &&other);
Tag &operator=(Tag &&other);
//Debugging
void print(bool = true, bool = true, bool = true, bool = true, bool = true);
private:
//Variables
//->For Tags/Interests
char _attr[INPUT_SIZE];
char _val[INPUT_SIZE];
uint8_t _attrHash[HASH_SIZE];
uint8_t _valHash[HASH_SIZE];
uint8_t _rHash[HASH_SIZE];
string _r = "";
int _attrLen;
int _valLen;
bool _isPublisher = true;
char _opr;
bool _match = false;
bool _real;
};
#endif