diff options
| author | Gustav Sörnäs <gustav@sornas.net> | 2020-12-01 15:25:23 +0100 |
|---|---|---|
| committer | Gustav Sörnäs <gustav@sornas.net> | 2020-12-01 15:25:23 +0100 |
| commit | 93c6b29368d1e0487937b433bc6e678da0058055 (patch) | |
| tree | 5e749adfecf2eab82b5e78bbeacc52fc8e2298fb /labb6/src/encoding.h | |
| parent | d4f35cf45ebc655d92cde8abb5c9a1c2822a08ba (diff) | |
| download | tddd86-93c6b29368d1e0487937b433bc6e678da0058055.tar.gz | |
given code l6
Diffstat (limited to 'labb6/src/encoding.h')
| -rwxr-xr-x | labb6/src/encoding.h | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/labb6/src/encoding.h b/labb6/src/encoding.h new file mode 100755 index 0000000..5a5fe48 --- /dev/null +++ b/labb6/src/encoding.h @@ -0,0 +1,33 @@ +/*
+ * TDDD86 Huffman Encoding
+ * This file declares the functions that you will need to write in this
+ * assignment for your Huffman Encoder in huffmanencoding.cpp.
+ *
+ * Please do not modify this provided file. Your turned-in files should work
+ * with an unmodified version of all provided code files.
+ */
+
+#ifndef _encoding_h
+#define _encoding_h
+
+#include <iostream>
+#include <string>
+#include <map>
+#include "bitstream.h"
+#include "HuffmanNode.h"
+using namespace std;
+
+/*
+ * See huffmanencoding.cpp for documentation of these functions
+ * (which you are supposed to write, based on the spec).
+ */
+map<int, int> buildFrequencyTable(istream& input);
+HuffmanNode* buildEncodingTree(const map<int, int>& freqTable);
+map<int, string> buildEncodingMap(HuffmanNode* encodingTree);
+void encodeData(istream& input, const map<int, string>& encodingMap, obitstream& output);
+void decodeData(ibitstream& input, HuffmanNode* encodingTree, ostream& output);
+void compress(istream& input, obitstream& output);
+void decompress(ibitstream& input, ostream& output);
+void freeTree(HuffmanNode* node);
+
+#endif
|
