-
Notifications
You must be signed in to change notification settings - Fork 19
/
Huffman.h
38 lines (29 loc) · 954 Bytes
/
Huffman.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
//
// Created by zawawy on 12/22/18.
//
#include <string.h>
#include <iostream>
#include <unordered_map>
#include <fstream>
#include <bits/stdc++.h>
#include "Node.h"
using namespace std;
#ifndef HUFFMANCODING_HUFFER_H
#define HUFFMANCODING_HUFFER_H
class Huffman {
unordered_map<char,string> codeMap;
void encodeCharacters(Node * rootNode, string codeString);
void writeHeader(ofstream &outputStream);
void readHeader(ifstream &inputStream);
Node* buildDecodingTree(unordered_map<char,string> encodingMap);
class myCompartor{
public :
int operator() (Node* node1, Node* node2);
};
public :
void huffer(unordered_map<char, int> frequencyMap);
void deHuffer(string fileName,string decompressedFileName);
void compressTofile(string InputfileName ,string OutputfileName);
void decompressToFile(string codeString,Node *rootNode,string decompressedFileName);
};
#endif //HUFFMANCODING_HUFFER_H