# HuffmanEncodingTree Class Reference

`#include <HuffmanEncodingTree.h>`

List of all members.

## Public Member Functions

| HuffmanEncodingTree ()
| ~HuffmanEncodingTree ()
void | EncodeArray (unsigned char *input, int sizeInBytes, RakNet::BitStream *output)
int | DecodeArray (RakNet::BitStream *input, int sizeInBits, int maxCharsToWrite, unsigned char *output)
void | DecodeArray (unsigned char *input, int sizeInBits, RakNet::BitStream *output)
void | GenerateFromFrequencyTable (unsigned long frequencyTable[256])
void | FreeMemory (void)

## Private Member Functions

void | InsertNodeIntoSortedList (HuffmanEncodingTreeNode *node, BasicDataStructures::LinkedList< HuffmanEncodingTreeNode * > *huffmanEncodingTreeNodeList) const

## Private Attributes

HuffmanEncodingTreeNode * | root
CharacterEncoding | encodingTable [256]

## Classes

struct | CharacterEncoding

## Detailed Description

This generates special cases of the huffman encoding tree using 8 bit keys with the additional condition that unused combinations of 8 bits are treated as a frequency of 1

## Constructor & Destructor Documentation

HuffmanEncodingTree::HuffmanEncodingTree | ( |  | ) |

HuffmanEncodingTree::~HuffmanEncodingTree | ( |  | ) |

## Member Function Documentation

void HuffmanEncodingTree::DecodeArray | ( | unsigned char * | input,
|  | int | sizeInBits,
|  | RakNet::BitStream * | output
| ) |

int HuffmanEncodingTree::DecodeArray | ( | RakNet::BitStream * | input,
|  | int | sizeInBits,
|  | int | maxCharsToWrite,
|  | unsigned char * | output
| ) |

| Two versions that perform the same operation. The second version also the number of bytes in the stream, which may be greater than the max chars to write

void HuffmanEncodingTree::EncodeArray | ( | unsigned char * | input,
|  | int | sizeInBytes,
|  | RakNet::BitStream * | output
| ) |

| Pass an array of bytes to array and a preallocated BitStream to receive the output

void HuffmanEncodingTree::FreeMemory | ( | void |  | ) |

| Free the memory used by the tree

void HuffmanEncodingTree::GenerateFromFrequencyTable | ( | unsigned long | frequencyTable[256] | ) |

| Given a frequency table of 256 elements, all with a frequency of 1 or more, generate the tree

void HuffmanEncodingTree::InsertNodeIntoSortedList | ( | HuffmanEncodingTreeNode * | node,
|  | BasicDataStructures::LinkedList< HuffmanEncodingTreeNode * > * | huffmanEncodingTreeNodeList
| ) | const`[private]`

## Member Data Documentation

CharacterEncoding HuffmanEncodingTree::encodingTable[256]`[private]`

HuffmanEncodingTreeNode* HuffmanEncodingTree::root `[private]`

| The root node of the tree

The documentation for this class was generated from the following files:

- Projects/raknet/include/raknet/HuffmanEncodingTree.h
- Projects/raknet/Source/HuffmanEncodingTree.cpp