Niedermayer.ca
Published on Niedermayer.ca (https://niedermayer.ca)

Home > Huffman Encoding Tables > Symbol header file

Symbol header file

Project Name: 
Huffman Encoding Trees [1]
  • Log in [2] to post comments
Filename: 
symbol.h
Language: 
C++
Summary: 

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

Source URL:https://niedermayer.ca/node/240

Links
[1] http://www.niedermayer.ca/node/229 [2] https://niedermayer.ca/user/login?destination=node/240%23comment-form