Main MRPT website > C++ reference for MRPT 1.4.0
zip.h
Go to the documentation of this file.
1/* +---------------------------------------------------------------------------+
2 | Mobile Robot Programming Toolkit (MRPT) |
3 | http://www.mrpt.org/ |
4 | |
5 | Copyright (c) 2005-2016, Individual contributors, see AUTHORS file |
6 | See: http://www.mrpt.org/Authors - All rights reserved. |
7 | Released under BSD License. See details in http://www.mrpt.org/License |
8 +---------------------------------------------------------------------------+ */
9#ifndef ZipCompression_H
10#define ZipCompression_H
11
13
14namespace mrpt
15{
16 namespace utils { class CStream; }
17
18 /** Data compression/decompression algorithms. \ingroup mrpt_base_grp */
19 namespace compress
20 {
21 /** Compression using the "zip" algorithm and from/to gzip (gz) files. \ingroup mrpt_base_grp */
22 namespace zip
23 {
24 /** Compress an array of bytes into another one. */
26 void *inData,
27 size_t inDataSize,
28 std::vector<unsigned char> &outData);
29
30 /** Compress an array of bytes into another one. */
32 const std::vector<unsigned char> &inData,
33 std::vector<unsigned char> &outData);
34
35 /** Compress an array of bytes and write the result into a stream. */
37 void *inData,
38 size_t inDataSize,
40
41 /** Compress an array of bytes and write the result into a stream. */
43 const std::vector<unsigned char> &inData,
45
46 /** Decompress an array of bytes into another one
47 * \exception std::exception If the apriori estimated decompressed size is not enought */
49 void *inData,
50 size_t inDataSize,
51 std::vector<unsigned char> &outData,
52 size_t outDataEstimatedSize);
53
54 /** Decompress an array of bytes into another one
55 * \exception std::exception If the apriori estimated decompressed size is not enought
56 */
58 void *inData,
59 size_t inDataSize,
60 void *outData,
61 size_t outDataBufferSize,
62 size_t &outDataActualSize);
63
64 /** Decompress an array of bytes into another one
65 * \exception std::exception If the apriori estimated decompressed size is not enought
66 */
68 mrpt::utils::CStream &inStream,
69 size_t inDataSize,
70 void *outData,
71 size_t outDataBufferSize,
72 size_t &outDataActualSize);
73
74
75 /** Decompress a gzip file (xxxx.gz) into a memory buffer. If the file is not a .gz file, it just read the whole file unmodified.
76 * \return true on success, false on error.
77 * \sa compress_gz_file, decompress_gz_data_block
78 */
80 const std::string &file_path,
81 vector_byte & buffer);
82
83 /** Compress a memory buffer into a gzip file (xxxx.gz).
84 * compress_level: 0=no compression, 1=best speed, 9=maximum
85 * \return true on success, false on error.
86 * \sa decompress_gz_file, compress_gz_data_block
87 */
89 const std::string &file_path,
90 const vector_byte &buffer,
91 const int compress_level = 9
92 );
93
94 /** Compress a memory buffer in gz-file format and return it as a block a memory.
95 * compress_level: 0=no compression, 1=best speed, 9=maximum
96 * \return true on success, false on error.
97 * \note If in_data is empty, an empty buffer is returned in out_gz_data and no error is reported.
98 * \sa compress_gz_file, de
99 */
101 const vector_byte &in_data,
102 vector_byte &out_gz_data,
103 const int compress_level = 9);
104
105 /** Decompress an array of bytes storing a gz-compressed stream of data into a memory buffer. If the input data is not recognized as a .gz file, the output data will be an exact copy of the input.
106 * \return true on success, false on error.
107 * \sa decompress_gz_file, compress_gz_data_block
108 */
110 const vector_byte &in_gz_data,
111 vector_byte &out_data);
112
113
114 } // End of namespace
115 } // End of namespace
116
117} // End of namespace
118
119#endif
This base class is used to provide a unified interface to files,memory buffers,..Please see the deriv...
Definition: CStream.h:39
std::vector< uint8_t > vector_byte
Definition: types_simple.h:26
bool BASE_IMPEXP compress_gz_data_block(const vector_byte &in_data, vector_byte &out_gz_data, const int compress_level=9)
Compress a memory buffer in gz-file format and return it as a block a memory.
bool BASE_IMPEXP compress_gz_file(const std::string &file_path, const vector_byte &buffer, const int compress_level=9)
Compress a memory buffer into a gzip file (xxxx.gz).
void BASE_IMPEXP decompress(void *inData, size_t inDataSize, std::vector< unsigned char > &outData, size_t outDataEstimatedSize)
Decompress an array of bytes into another one.
bool BASE_IMPEXP decompress_gz_data_block(const vector_byte &in_gz_data, vector_byte &out_data)
Decompress an array of bytes storing a gz-compressed stream of data into a memory buffer.
void BASE_IMPEXP compress(void *inData, size_t inDataSize, std::vector< unsigned char > &outData)
Compress an array of bytes into another one.
bool BASE_IMPEXP decompress_gz_file(const std::string &file_path, vector_byte &buffer)
Decompress a gzip file (xxxx.gz) into a memory buffer.
This is the global namespace for all Mobile Robot Programming Toolkit (MRPT) libraries.



Page generated by Doxygen 1.9.6 for MRPT 1.4.0 SVN: at Thu Mar 23 03:22:58 UTC 2023