clockUtils  1.1
HuffmanGeneric.h
Go to the documentation of this file.
1 /*
2  * clockUtils
3  * Copyright (2015) Michael Baer, Daniel Bonrath, All rights reserved.
4  *
5  * This file is part of clockUtils; clockUtils is free software; you can redistribute it and/or
6  * modify it under the terms of the GNU Lesser General Public
7  * License as published by the Free Software Foundation; either
8  * version 2.1 of the License, or (at your option) any later version.
9  *
10  * This library is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13  * Lesser General Public License for more details.
14  *
15  * You should have received a copy of the GNU Lesser General Public
16  * License along with this library; if not, write to the Free Software
17  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
18  */
19 
25 #ifndef __CLOCKUTILS_COMPRESSION_ALGORITHM_HUFFMANGENERIC_H__
26 #define __CLOCKUTILS_COMPRESSION_ALGORITHM_HUFFMANGENERIC_H__
27 
29 
30 namespace clockUtils {
31 namespace compression {
32 namespace algorithm {
33 
39  public:
43  static ClockError compress(const std::string & uncompressed, std::string & compressed);
44 
48  static ClockError decompress(const std::string & compressed, std::string & decompressed);
49 
50  private:
54  static void convert(const std::string & text, const std::shared_ptr<Node> & node, size_t index, std::string & result);
55 
60  static std::vector<uint8_t> calcFrequencies(const std::string & text);
61  };
62 
63 } /* namespace algorithm */
64 } /* namespace compression */
65 } /* namespace clockUtils */
66 
67 #endif /* __CLOCKUTILS_COMPRESSION_ALGORITHM_HUFFMANGENERIC_H__ */
68 
#define CLOCK_COMPRESSION_API
class for Huffman compression using a dictionary generated out of the given string has always an over...
base class for Huffman compression contains common methods and helper structures
Definition: HuffmanBase.h:45
ClockError
Definition: errors.h:30