-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathhuffcode.hpp
44 lines (30 loc) · 939 Bytes
/
huffcode.hpp
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
// huffcode.hpp UNFINISHED
// Glenn G. Chappell
// 29 Nov 2015
//
// For CS 411/611 Fall 2015
// Assignment 6, Exercise A
// Header for class HuffCode
//
// Modified 11/22/17
// Chris Hartman
// For CS 411 Fall 2017
#ifndef FILE_HUFFCODE_H_INCLUDED
#define FILE_HUFFCODE_H_INCLUDED
#include <string>
#include <unordered_map>
// Class HuffCode
// Encoding & decoding using a Huffman code
class HuffCode {
// ***** HuffCode: ctors, dctor, op= *****
public:
// Compiler-generated default ctor, copy ctor, copy =, dctor used
// ***** HuffCode: general public functions *****
public:
void setWeights(const std::unordered_map<char, int> & theweights);
std::string encode(const std::string & text) const;
std::string decode(const std::string & codestr) const;
// ***** HuffCode: data members *****
private:
}; // End class HuffCode
#endif //#ifndef FILE_HUFFCODE_H_INCLUDED