Disk ARchive  2.7.15
Full featured and portable backup and archiving tool
lz4_module.hpp
Go to the documentation of this file.
1 /*********************************************************************/
2 // dar - disk archive - a backup/restoration program
3 // Copyright (C) 2002-2024 Denis Corbin
4 //
5 // This program is free software; you can redistribute it and/or
6 // modify it under the terms of the GNU General Public License
7 // as published by the Free Software Foundation; either version 2
8 // of the License, or (at your option) any later version.
9 //
10 // This program 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
13 // GNU General Public License for more details.
14 //
15 // You should have received a copy of the GNU General Public License
16 // along with this program; if not, write to the Free Software
17 // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
18 //
19 // to contact the author, see the AUTHOR file
20 /*********************************************************************/
21 
34 
35 #ifndef LZ4_MODULE_HPP
36 #define LZ4_MODULE_HPP
37 
38 extern "C"
39 {
40 #if HAVE_LZ4_H
41 #include <lz4.h>
42 #endif
43 }
44 
45 #include "../my_config.h"
46 
47 #include "compress_module.hpp"
48 
49 namespace libdar
50 {
51 
54 
55  class lz4_module: public compress_module
56  {
57  public:
58  lz4_module(U_I compression_level = 9);
59  lz4_module(const lz4_module & ref);
60  lz4_module(lz4_module && ref) noexcept;
61  lz4_module & operator = (const lz4_module & ref);
62  lz4_module & operator = (lz4_module && ref) noexcept;
63  virtual ~lz4_module() noexcept;
64 
65  // inherited from compress_module interface
66 
67  virtual compression get_algo() const override { return compression::lz4; };
68 
69  virtual U_I get_max_compressing_size() const override;
70 
71  virtual U_I get_min_size_to_compress(U_I clear_size) const override;
72 
73  virtual U_I compress_data(const char *normal,
74  const U_I normal_size,
75  char *zip_buf,
76  U_I zip_buf_size) const override;
77 
78  virtual U_I uncompress_data(const char *zip_buf,
79  const U_I zip_buf_size,
80  char *normal,
81  U_I normal_size) const override;
82 
83 
84  virtual std::unique_ptr<compress_module> clone() const override;
85 
86  private:
87  U_I acceleration;
88  char *state;
89 
90  };
92 
93 } // end of namespace
94 
95 #endif
provides abstracted interface of per-block compression/decompression
compression
the different compression algorithm available
Definition: compression.hpp:46
@ lz4
lz4 (streamed)
libdar namespace encapsulate all libdar symbols
Definition: archive.hpp:47