///////////
//
//  puff.hpp
//              header for puff.cpp package
//
//      AUTHOR: Aaron Lenard Hatcher (hatcher@fas.harvard.edu)
//          and Russell James Lowke  (lowke@fas.harvard.edu)
//
//		  T.Fs: Francis Crick & Bryan Kim
//
//		  Date: 8/12/2002
//
//  CSCIE-s111: Assignment Nine, Huffman Encoding
//

#ifndef _Puff_H_
#define _Puff_H_


#include <iostream>
#include <iomanip>
#include <fstream>
#include <cstring>
#include <cctype>
#include "bits.hpp"
#include "utils.hpp"


//
// expand Huffman encoded binary file to ASCII
//
class Puff							
{
	private:
        
	  char		*inFile;		 				// name of BINARY file to read from
	  ifstream 	inStream;						// in stream for file
	  char		*outFile;						// name of ASCII file to write to
	  ofstream 	outStream;						// out stream for file
	         
	  int		table[TOTLETTERS];				// frequency array
	  Forest 	*forestKey;						// key to forest class
            
	public:

	  // methods
	  Puff(char *iFilename,
	  	   char *oFilename); 					// constructor
	  void	openFile();							// ensures file fileName (inFile)
	  void	frequencyTable();					// reads in a frequency table from
												// the header of file inFile
	  void	decompressToFile();					// converts ascii to Huffman encoded
												// binary and saves to file
	  void clearMemory();
	  
};

#endif /* _Puff_H_ */
