Symbol header file
Submitted by Daryle on Thu, 05/17/2012 - 15:39
Filename: | symbol.h |
Project Name: | Huffman Encoding Trees |
Language: | C++ |
Description: |
This header file defines the classes, properties and method prototypes for the Huffman tree and symbol tables. |
Code:
#ifndef _SYMBOL_ #define _SYMBOL_ #include <assert.h> class Tree; class Symbol { friend class Tree; private: char Character; Symbol *Parent, *LeftChild, *RightChild; bool Mark; float Probability; char CodeBit[16]; int Depth; public: Symbol(); Symbol(char,float); ~Symbol(); }; //========================================== class Tree { public: Tree(); ~Tree(); void insertSymbol(char, float); int showLength(); void displayTree(); int findLow(); int markSymbol(); void moveSymbols(Tree*); displaySymbol(); void printTree(Symbol*); void printTree(void); void assignBits(); void assignBits(Symbol*, char*); void writeTable(ofstream*); void writeTable(ofstream*,Symbol*); protected: Symbol *Root, *PtrCurrent; int Count; int Depth; Symbol* removeSymbol(); int BranchCounter; void insertSymbol(Symbol*,Symbol*); void insertSymbol(Symbol*); }; #include "Symbol.cpp" #endif