OGLplus  (0.59.0) a C++ wrapper for rendering APIs

compression.hpp
Go to the documentation of this file.
1 
9 #ifndef EAGINE_COMPRESSION_HPP
10 #define EAGINE_COMPRESSION_HPP
11 
12 #include "callable_ref.hpp"
13 #include "memory/block.hpp"
14 #include "memory/buffer.hpp"
15 #include <memory>
16 
17 namespace eagine {
18 //------------------------------------------------------------------------------
24  none,
26  lowest,
28  normal,
30  highest
31 };
32 //------------------------------------------------------------------------------
33 class data_compressor_impl;
34 
38 public:
41 
44 
46  auto compress(
47  memory::const_block input,
48  const data_handler& handler,
49  data_compression_level level) -> bool;
50 
52  auto compress(
53  memory::const_block input,
54  memory::buffer& output,
56 
60  return compress(input, output, data_compression_level::normal);
61  }
62 
66 
68  auto decompress(memory::const_block input, const data_handler& handler)
69  -> bool;
70 
72  auto decompress(memory::const_block input, memory::buffer& output)
74 
77 
78 private:
79  std::shared_ptr<data_compressor_impl> _pimpl{};
80 };
81 //------------------------------------------------------------------------------
82 } // namespace eagine
83 
84 #if !EAGINE_LINK_LIBRARY || defined(EAGINE_IMPLEMENTING_LIBRARY)
85 #include <eagine/compression.inl>
86 #endif
87 
88 #endif // EAGINE_COMPRESSION_HPP
auto compress(memory::const_block input, memory::buffer &output) -> memory::const_block
Compress the input block, writing the compressed data to output.
Definition: compression.hpp:58
Declaration of class template storing a reference to a callable object.
Definition: callable_ref.hpp:24
Common code is placed in this namespace.
Definition: eagine.hpp:21
basic_block< true > const_block
Alias for const byte memory span.
Definition: block.hpp:32
@ highest
Slowest compression method highest compression level.
Reallocatable owning byte buffer.
Definition: buffer.hpp:22
callable_ref< bool(memory::const_block)> data_handler
Alias for data handler callable type.
Definition: compression.hpp:43
Non-owning view of a contiguous range of memory with ValueType elements.
Definition: flatten_fwd.hpp:16
auto compress(memory::const_block input, const data_handler &handler, data_compression_level level) -> bool
Compress the input block, passing the packed data to handler.
Class implementing data compression and decompresson.
Definition: compression.hpp:37
data_compression_level
Data compression level enumeration.
Definition: compression.hpp:22
@ normal
Normal compression level.
auto decompress(memory::const_block input, const data_handler &handler) -> bool
Decompress the input block, passing the unpacked data to handler.
@ lowest
Fastest compression method lowest compression level.
data_compressor()
Default constructor.

Copyright © 2015-2021 Matúš Chochlík.
<chochlik -at -gmail.com>
Documentation generated on Tue Apr 13 2021 by Doxygen (version 1.8.17).