X-Git-Url: http://git.nguyen.vg/gitweb/?a=blobdiff_plain;f=libcds%2Fsrc%2Fcoders%2Fhuffman_codes.h;fp=libcds%2Fsrc%2Fcoders%2Fhuffman_codes.h;h=0000000000000000000000000000000000000000;hb=58aa6c1117e13edd366329cdcac4ba7388faed95;hp=7538225ce562d595c595e2bee94933850a2df9fe;hpb=a75155efc2ed07c1907ef017360bd719a47f9c06;p=SXSI%2FXMLTree.git diff --git a/libcds/src/coders/huffman_codes.h b/libcds/src/coders/huffman_codes.h deleted file mode 100644 index 7538225..0000000 --- a/libcds/src/coders/huffman_codes.h +++ /dev/null @@ -1,63 +0,0 @@ -/* huffman_codes.h - Copyright (C) 2008, Francisco Claude, all rights reserved. - - Wrapper for huff written by Gonzalo Navarro - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with this library; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - -*/ - -#ifndef HUFFMAN_CODES_H -#define HUFFMAN_CODES_H - -#include -#include - -/** Wrapper for the canonical huffman implementation of Gonzalo Navarro. - * - * @author Francisco Claude - */ -class huffman_codes { - - public: - /** Creates the codes for the sequence seq of length n */ - huffman_codes(uint * seq, uint n); - huffman_codes(uchar * seq, uint n); - ~huffman_codes(); - - /** Encodes symb into stream at bit-position pos, return the ending position (bits) */ - ulong encode(uint symb, uint * stream, ulong pos); - - /** decodes into symb from stream at bit-position pos, returns the new position */ - ulong decode(uint * symb, uint * stream, ulong pos); - - /** Returns the maximum length of a code */ - uint max_length(); - - /** Returns the size of the table */ - uint size(); - - /** Saves the coder to a file */ - uint save(FILE *fp); - - /** Loads a coder from a file */ - static huffman_codes * load(FILE *fp); - - protected: - huffman_codes(); - THuff huff_table; -}; - -#endif