Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members

mxcpcHuffmanTree.h

00001 //           ///          //
00002 //          /////        ////
00003 //         /// XXX     XXX ///
00004 //        ///    XXX XXX    ///     $RCSfile: mxcpcHuffmanTree.h,v $  
00005 //       ///       XXX       ///     $Revision: 1.3 $
00006 //      ///      XXX XXX      ///     $Date: 2005/08/09 13:57:26 $
00007 //     ////    XXX     XXX    ////     $Author: cvs-steve $
00008 //    ////                     ////
00009 //   ////  M  O  B  O  T  I  X  ////////////////////////////////////////////////
00010 //  //// Security Vision Systems ///////////////////////////////////////////////
00011 
00012 // Copyright (c) 2005, MOBOTIX AG.
00013 // This software is made available under the BSD licence. Please refer 
00014 // to the file LICENCE.TXT contained in this distribution for details.
00015 
00016 
00017 #ifndef __MXCPC_HUFFMANTREE_H__
00018 #define __MXCPC_HUFFMANTREE_H__
00019 
00020 
00021 
00022 
00025 
00028 class mxcpcHuffmanTree {
00029 
00030  public:
00031   struct Node {
00032     Node *Child0, *Child1;
00033     bool IsLeaf;
00034     unsigned char Value;
00035   };
00036   
00037  private:
00038   Node *RootNode; 
00039   Node *GroundNode;
00040 
00041  public:
00042   mxcpcHuffmanTree();
00043   ~mxcpcHuffmanTree();
00044   
00045  public:
00047   const Node *getRoot(void);
00048    
00050   void clear(void);
00051   
00054 
00058   bool configureFromTable(const unsigned char *table, int max_path_len = 16);
00059   
00062 
00066   bool addLeaf(int path_len, unsigned char value);
00067   
00069   int countLeaves(void);
00070   
00071  private:
00073   void deleteSubTree(Node *subtree_root);
00076 
00080   bool addLeaf(Node *subtree_root, int path_len, Node *leaf);
00083 
00089   void groundUnusedPaths(Node *subtree);
00091   int countLeaves(Node *subtree);
00092 };
00093 
00094 
00095 
00096 #endif   // __MXCPC_HUFFMANTREE_H__

Generated on Mon Aug 15 03:39:30 2005 for mxcpc by  doxygen 1.4.2-20050421