2#include <NDEVR/Buffer.h>
3#include <NDEVR/Dictionary.h>
4#include <NDEVR/String.h>
5#include <NDEVR/Pointer.h>
6#define NDEVR_SUPPORTS_ZFP 0
54 template<
class t_type>
68 if (
sizeof(t_type) == 4)
70 else if (
sizeof(t_type) == 8)
74 if (
sizeof(t_type) / 2 == 4)
76 else if (
sizeof(t_type) / 2 == 8)
80 if (
sizeof(t_type) / 3 == 4)
82 else if (
sizeof(t_type) / 3 == 8)
86 if (
sizeof(t_type) / 4 == 4)
88 else if (
sizeof(t_type) / 4 == 8)
97 return compression_mode;
100 template<
class t_type,
class t_index_type,
class t_memory_allocator,
class t_memory_manager>
103 object.buffer_size = data.
size();
104 if (
object.buffer_size != 0)
106 object.compression_mode = Compressor::PickCompressionMode<t_type>(
object.compression_mode);
107 object.uncompressed_data = (
uint01*)data.
ptr();
108 object.uncompressed_size = data.
memSize();
109 switch (
object.compression_mode)
116 compression_data.
clear();
117 object.compressed_size = 0;
121 object.compressed_size = data.
memSize();
124 object.compressed_data = compression_data.
begin();
125 CompressData(
object);
127 compression_data.
setSize(cast<t_index_type>(
object.compressed_size));
132 compression_data.
clear();
136 template<
class t_index_type,
class t_memory_allocator,
class t_memory_manager>
144 locations[i] = info.
index;
146 Compress(
object, compression_data, locations);
149 template<
class t_type,
class t_index_type,
class t_memory_allocator,
class t_memory_manager>
155 Buffer<
decltype(t_type::Type())> combined_data;
158 sizes[i] = data[i].
size();
159 combined_data.addAll(data[i]);
161 compression_data.
clear();
166 Compress(*sub_obj, temp_compress, sizes);
167 compression_data += temp_compress;
169 Compress(
object, temp_compress, combined_data);
170 compression_data += temp_compress;
A specification of upper and lower bounds in N-dimensions.
Definition Bounds.hpp:57
The equivelent of std::vector but with a bit more control. The basic array unit of the library.
Definition Buffer.hpp:64
constexpr t_index_type size() const
Definition Buffer.hpp:1461
decltype(auto) ptr()
Definition Buffer.hpp:489
void setSize(t_index_type new_size)
Definition Buffer.hpp:1413
decltype(auto) begin()
Definition Buffer.hpp:504
t_index_type memSize() const
Definition Buffer.hpp:499
void clear()
Definition Buffer.hpp:572
Definition Compressor.h:52
static sint04 ZLibCompress(uint01 *compressed, const uint01 *uncompressed, size_t &compressed_size, size_t decompressed_size)
static void DecompressData(BinaryCompressionObject &data)
static Module ZLibModule()
static CompressedStringInfo AddString(BinaryCompressionObject &data, const String &string)
static sint04 ZLibDecompressFile(File src, File output_dir)
static uint04 GetStringLength(BinaryCompressionObject &data, uint04 index)
static void CompressData(BinaryCompressionObject &data)
static char * GetString(BinaryCompressionObject &data, uint04 index)
static char * GetString(BinaryCompressionObject &data, const Bounds< 1, uint04 > &bounds)
static std::enable_if< ObjectInfo< t_type >::Buffer >::type Compress(BinaryCompressionObject &object, Buffer< uint01 > &compression_data, const Buffer< t_type, t_index_type, t_memory_allocator, t_memory_manager > &data)
Definition Compressor.h:150
static CompressionMode PickCompressionMode(CompressionMode compression_mode=e_default_compression)
Definition Compressor.h:55
static std::enable_if<!ObjectInfo< t_type >::Buffer >::type Compress(BinaryCompressionObject &object, Buffer< uint01 > &compression_data, const Buffer< t_type, t_index_type, t_memory_allocator, t_memory_manager > &data)
Definition Compressor.h:101
static void CompressString(BinaryCompressionObject &object, Buffer< uint01 > &compression_data, const Buffer< String, t_index_type, t_memory_allocator, t_memory_manager > &data)
Definition Compressor.h:137
static sint04 ZLibDecompress(const uint01 *compressed, uint01 *uncompressed, size_t compressed_size, size_t &decompressed_size)
Definition Dictionary.h:48
Definition Pointer.hpp:303
int32_t sint04
-Defines an alias representing a 4 byte, signed integer. -Can represent exact integer values -2147483...
Definition BaseValues.hpp:76
uint8_t uint01
-Defines an alias representing a 1 byte, unsigned integer -Can represent exact integer values 0 throu...
Definition BaseValues.hpp:98
CompressionMode
Definition Compressor.h:12
@ e_best_compression
Definition Compressor.h:18
@ e_floating_point_compression_1_fltp04
Definition Compressor.h:19
@ e_floating_point_compression_2_fltp04
Definition Compressor.h:20
@ e_default_compression
Definition Compressor.h:14
@ e_floating_point_compression_4_fltp08
Definition Compressor.h:26
@ e_floating_point_compression_3_fltp08
Definition Compressor.h:25
@ e_no_compression
Definition Compressor.h:13
@ e_floating_point_compression_2_fltp08
Definition Compressor.h:24
@ e_string_compression
Definition Compressor.h:16
@ e_floating_point_compression_4_fltp04
Definition Compressor.h:22
@ e_compression_count
Definition Compressor.h:28
@ e_floating_point_compression_1_fltp08
Definition Compressor.h:23
@ e_floating_point_compression_3_fltp04
Definition Compressor.h:21
@ e_best_speed
Definition Compressor.h:15
@ e_floating_point_compression
Definition Compressor.h:17
@ e_string_reference
Definition Compressor.h:27
uint64_t uint08
-Defines an alias representing an 8 byte, unsigned integer -Can represent exact integer values 0 thro...
Definition BaseValues.hpp:132
uint32_t uint04
-Defines an alias representing a 4 byte, unsigned integer -Can represent exact integer values 0 throu...
Definition BaseValues.hpp:120
Definition Compressor.h:38
uint01 * compressed_data
Definition Compressor.h:42
uint08 compressed_size
Definition Compressor.h:43
Buffer< Bounds< 1, uint04 > > * m_string_size_info
Definition Compressor.h:47
uint01 * uncompressed_data
Definition Compressor.h:40
Dictionary< String, uint04 > * m_string_reference
Definition Compressor.h:46
uint08 uncompressed_size
Definition Compressor.h:41
String * m_strings
Definition Compressor.h:48
CompressionMode compression_mode
Definition Compressor.h:39
DynamicPointer< BinaryCompressionObject > compression_link
Definition Compressor.h:49
uint08 buffer_size
Definition Compressor.h:44
Definition Compressor.h:32
Bounds< 1, uint04 > bounds
Definition Compressor.h:34
uint04 index
Definition Compressor.h:33
Definition ModuleManager.h:54
Information about the object.
Definition ObjectInfo.h:56