tachia

Untitled

Jun 20th, 2018
59
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.06 KB | None | 0 0
  1. void compress(ibstream& infile, obstream& outfile) {
  2.     Map<ext_char, int> frequencies = getFrequencyTable(infile);
  3.     Node* tree = buildEncodingTree(frequencies);
  4.     writeFileHeader(outfile, frequencies);
  5.     infile.rewind();
  6.     encodeFile(infile, tree, outfile);
  7.     freeTree(tree);
  8. }
  9.  
  10. /* Function: decompress
  11.  * Usage: decompress(infile, outfile);
  12.  * --------------------------------------------------------
  13.  * Main entry point for the Huffman decompressor.
  14.  * Decompresses the file whose contents are specified by the
  15.  * input ibstream, then writes the decompressed version of
  16.  * the file to the stream specified by outfile.  Your final
  17.  * task in this assignment will be to combine all of the
  18.  * previous functions together to implement this function,
  19.  * which should not require much logic of its own and should
  20.  * primarily be glue code.
  21.  */
  22. void decompress(ibstream& infile, ostream& outfile) {
  23.     Map<ext_char, int> frequenceTable = readFileHeader(infile);
  24.     Node* tree = buildEncodingTree(frequenceTable);
  25.     decodeFile(infile, tree, outfile);
  26.     freeTree(tree);
  27. }
Advertisement
Add Comment
Please, Sign In to add comment