///////////
//
//  huff.hpp
//              header for huff.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 _HUFF_H_
#define _HUFF_H_

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

const int MAXSTR  = 256;

//
// compresses ASCII file to Huffman encoded binary
//
class Huff	
{
	private:
        
	  char		*inFile;			 			// name of ASCII file to read from
	  ifstream 	inStream;						// in stream for file
	  char		*outFile;			 			// name of BINARY file to write to
	  ofstream 	outStream;						// out stream for file
            
	  int		table[TOTLETTERS];				// frequency array
	  Forest	*forestKey;						// key to forest class
            
 
	public:
        
	  // methods
	  Huff(char *iFilename,
	  	   char *oFilename); 					// constructor
	  void		openFile();						// ensures file iFilename
	  void		frequencyTable();				// counts out a frequency table
	  											// from ascii file inFile
	  void		compressToFile();				// converts ascii to Huffman
	  											// encoded binary and saves to file
	  void		clearMemory();
	  	
};

#endif /* _HUFF_H_ */
