-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbyte.h
More file actions
30 lines (25 loc) · 936 Bytes
/
byte.h
File metadata and controls
30 lines (25 loc) · 936 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
#ifndef BYTE_H
#define BYTE_H
#include <vector>
using std::vector;
class Binary_Storage;
class Simple_Tree;
class Shrunk_Byte
{
private:
unsigned char byte; // The original byte expression
unsigned int count; // Count of given byte in file
Shrunk_Byte * parent; // Parent Node. For easily tranversing the tree
Shrunk_Byte * left; // Left Node
Shrunk_Byte * right; // Right Node
bool visited; // true if visited in tree traversal. Reset on tree tranversal
vector<unsigned char> path; // The location inside the tree, to quickly encode the compression. 0 = left, true = 1
public:
Shrunk_Byte(int _byte, int _count); // Constructor, shrunk is set false on all 8 bit
bool operator > (const Shrunk_Byte & other); // Compare only count
void assign_left(Shrunk_Byte * _left);
void assign_right(Shrunk_Byte * _right);
friend class Binary_Storage;
friend class Simple_Tree;
};
#endif