Octane v1.01.20 - The Open Compression Toolkit for C++ http://octane.sourceforge.net/
Homepage | Main | Modules | Class Hierarchy | Compound List | File List | Compound Members | Related Pages

HuffNode_Leaf Class Reference

#include <huffmannodes.hpp>

Inheritance diagram for HuffNode_Leaf:

HuffNode List of all members.

Detailed Description

The leaves of the huffman tree contains actual symbol information.

Each node holds a bitvector representing its bitcode for output/input, which is calculated by traversing the final huffman tree. We store it explicitly for fast access during coding. A node also contains the symbol id# that it corresponds to in the parser.

Definition at line 183 of file huffmannodes.hpp.

Public Member Functions

 HuffNode_Leaf (int insymbolid, THuffmanNodeWeight inweight)
 constructor

virtual ~HuffNode_Leaf ()
 destructor

void recursive_freechildren ()
 freeing memory occupied by this node and any children

virtual void traverse_buildbitcodes (std::bitset< DEF_HUFFMANPQ_MAXFUNCBITS > &current_bitset, int bitsetlength)
 recursive traversal of huffman tree for building bitcodes

int get_symbolid ()
 get the symbol id# corresponding to this symbol

void set_symbolid (int val)
 set the symbol id#

unsigned char get_bitcode_length ()
 get length of bitcode

std::string get_bitcode_string ()
 get a string representation of the bitcode (useful for debugging)

virtual unsigned int get_memoryused () const
 space used by the node

virtual bool isleaf ()
 is this a leaf node (this is an RTTI type function)

virtual bool AddBitsToBitWriter (bitwriter &bw)
 add the bits from this leaf symbol to the output bitwriter, will depend on derived class


Protected Attributes

unsigned char code_bitsetlength
std::bitset< DEF_HUFFMANPQ_MAXIMUM_CODEBITDEPTH > code_bitset
 the bits used to code this symbol in the huffman tree

int symbolid
 the parser symbol id# that this node refers to


Member Function Documentation

virtual unsigned int HuffNode_Leaf::get_memoryused  )  const [inline, virtual]
 

space used by the node

Todo:
do we really need to add sizeof(code_bitset) as we are doing?

Reimplemented from HuffNode.

Definition at line 212 of file huffmannodes.hpp.

References code_bitset.

00212 {return (unsigned int)(sizeof(this)+sizeof(code_bitset));}


The documentation for this class was generated from the following files:  
Generated on 20 May 2004 by doxygen 1.3.3