![]() |
NDEVR
API Documentation
|
A series of static methods designed to compress objects and reduce their memory consumption or file size. More...
Static Public Member Functions | |
| static CompressedStringInfo | AddString (BinaryCompressionObject &data, const String &string) |
| Adds a string to the BinaryCompressionObject, returning the Compressed string info. | |
| template<class t_type, class t_memory_manager> | |
| static std::enable_if< ObjectInfo< t_type >::Buffer >::type | Compress (BinaryCompressionObject &object, Buffer< uint01 > &compression_data, const Buffer< t_type, t_memory_manager > &data) |
| Compresses a buffer of buffer-type elements (nested buffers) by flattening sub-buffer sizes and contents, then compressing each part separately. | |
| template<class t_type, class t_memory_manager> | |
| static std::enable_if<!ObjectInfo< t_type >::Buffer >::type | Compress (BinaryCompressionObject &object, Buffer< uint01 > &compression_data, const Buffer< t_type, t_memory_manager > &data) |
| Compresses a buffer of non-buffer (flat) elements into the given compression object. | |
| static void | CompressData (BinaryCompressionObject &data) |
| Compresses the BinaryCompressionObject. | |
| template<class t_memory_manager> | |
| static void | CompressString (BinaryCompressionObject &object, Buffer< uint01 > &compression_data, const Buffer< String, t_memory_manager > &data) |
| Compresses a buffer of strings by adding each to the shared string table and then compressing the resulting index buffer. | |
| static void | DecompressData (BinaryCompressionObject &data) |
| Decompresses the BinaryCompressionObject. | |
| static char * | GetString (BinaryCompressionObject &data, const Bounds< 1, uint04 > &bounds) |
| Retrieves a raw string pointer from the compression object using byte offset bounds. | |
| static char * | GetString (BinaryCompressionObject &data, uint04 index) |
| Retrieves a raw string pointer from the compression object by reference index. | |
| static uint04 | GetStringLength (BinaryCompressionObject &data, uint04 index) |
| Returns the length of a stored string identified by its reference index. | |
| template<class t_type> | |
| static CompressionMode | PickCompressionMode (CompressionMode compression_mode=e_default_compression) |
| Selects the most appropriate compression mode for the given type. | |
| static sint04 | ZLibCompress (uint01 *compressed, const uint01 *uncompressed, size_t &compressed_size, size_t decompressed_size) |
| A simple, raw call into zlibs compress function, except if the compressed size is larger than the uncompressed size, in which case the contents of compressed are copied over. | |
| static sint04 | ZLibCompressFile (File src, File output, const PasswordString &password=PasswordString()) |
| Compresses a file or folder and writes it to an output. | |
| static sint04 | ZLibDecompress (const uint01 *compressed, uint01 *uncompressed, size_t compressed_size, size_t &decompressed_size) |
| A simple, raw call into zlibs uncompress function. | |
| static sint04 | ZLibDecompressFile (File src, File output_dir, const PasswordString &password=PasswordString()) |
| Decompresses a file or folder and writes it to an output directory. | |
| static Module | ZLibModule () |
| Returns module information for the version of zlib used in this implementation. | |
A series of static methods designed to compress objects and reduce their memory consumption or file size.
Typically objects are added to a BinaryCompressionObject which does something with the data and allows this function to be safely used in a mutlithreaded envirnoment.
Definition at line 73 of file Compressor.h.
|
inlinestatic |
Compresses a buffer of buffer-type elements (nested buffers) by flattening sub-buffer sizes and contents, then compressing each part separately.
A linked BinaryCompressionObject is created to hold the size data, while the main object holds the combined element data.
| [in] | object | The compression object to populate and compress into. |
| [in] | compression_data | Output buffer that receives all compressed byte data. |
| [in] | data | The source buffer of nested buffers to compress. |
Definition at line 267 of file Compressor.h.
References cast(), Compress(), BinaryCompressionObject::compressed_data, BinaryCompressionObject::compressed_size, and BinaryCompressionObject::compression_link.
|
inlinestatic |
Compresses a buffer of non-buffer (flat) elements into the given compression object.
Populates the BinaryCompressionObject with type info and size, selects the appropriate compression mode, then delegates to CompressData to perform the actual compression.
| [in] | object | The compression object to populate and compress into. |
| [in] | compression_data | Output buffer that receives the compressed byte data. |
| [in] | data | The source buffer of elements to compress. |
Definition at line 200 of file Compressor.h.
References cast(), CompressData(), e_string_compression, e_string_reference, GetTypeInfo(), and PickCompressionMode().
Referenced by Compress(), TableColumnBuffer< t_type >::compress(), and CompressString().
|
inlinestatic |
Compresses a buffer of strings by adding each to the shared string table and then compressing the resulting index buffer.
| [in] | object | The compression object that holds the string reference table. |
| [in] | compression_data | Output buffer that receives the compressed index data. |
| [in] | data | The source buffer of strings to compress. |
Definition at line 244 of file Compressor.h.
References AddString(), Compress(), and CompressedStringInfo::index.
|
static |
Retrieves a raw string pointer from the compression object using byte offset bounds.
| [in] | data | The compression object containing the string data. |
| [in] | bounds | The byte offset bounds identifying the string within the buffer. |
|
static |
Retrieves a raw string pointer from the compression object by reference index.
| [in] | data | The compression object containing the string data. |
| [in] | index | The reference index of the string to retrieve. |
|
static |
Returns the length of a stored string identified by its reference index.
| [in] | data | The compression object containing the string data. |
| [in] | index | The reference index of the string. |
|
inlinestatic |
Selects the most appropriate compression mode for the given type.
If the requested mode is e_best_compression or e_default_compression, this method inspects the type traits to pick a specialized mode (e.g., string reference or ZFP floating-point).
| [in] | compression_mode | The initial or requested compression mode. |
Definition at line 147 of file Compressor.h.
References e_best_compression, e_default_compression, e_floating_point_compression_1_fltp04, e_floating_point_compression_1_fltp08, e_floating_point_compression_2_fltp04, e_floating_point_compression_2_fltp08, e_floating_point_compression_3_fltp04, e_floating_point_compression_3_fltp08, e_floating_point_compression_4_fltp04, e_floating_point_compression_4_fltp08, and e_string_reference.
Referenced by Compress(), BinaryFile::write(), and BinaryFile::write().
|
static |
Compresses a file or folder and writes it to an output.
Optionally, a password may be used to ensure contents are protected. This will not destroy or alter the original source file.
| FileException | if the output_dir is not a directory or if IO operations fail. |
|
static |
Decompresses a file or folder and writes it to an output directory.
Optionally, a password may be used to decode the data. This will not destroy or alter the original zip file.
| FileException | if the output_dir is not a directory or if IO operations fail. |