Main MRPT website > C++ reference for MRPT 1.9.9
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-2017, 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 
12 #include <mrpt/utils/utils_defs.h>
13 
14 namespace mrpt
15 {
16 namespace utils
17 {
18 class CStream;
19 }
20 
21 /** Data compression/decompression algorithms. \ingroup mrpt_base_grp */
22 namespace compress
23 {
24 /** Compression using the "zip" algorithm and from/to gzip (gz) files. \ingroup
25  * mrpt_base_grp */
26 namespace zip
27 {
28 /** Compress an array of bytes into another one. */
29 void compress(
30  void* inData, size_t inDataSize, std::vector<unsigned char>& outData);
31 
32 /** Compress an array of bytes into another one. */
33 void compress(
34  const std::vector<unsigned char>& inData,
35  std::vector<unsigned char>& outData);
36 
37 /** Compress an array of bytes and write the result into a stream. */
38 void compress(void* inData, size_t inDataSize, mrpt::utils::CStream& out);
39 
40 /** Compress an array of bytes and write the result into a stream. */
41 void compress(
42  const std::vector<unsigned char>& inData, mrpt::utils::CStream& out);
43 
44 /** Decompress an array of bytes into another one
45  * \exception std::exception If the apriori estimated decompressed size is not
46  * enought */
47 void decompress(
48  void* inData, size_t inDataSize, std::vector<unsigned char>& outData,
49  size_t outDataEstimatedSize);
50 
51 /** Decompress an array of bytes into another one
52  * \exception std::exception If the apriori estimated decompressed size is not
53  * enought
54  */
55 void decompress(
56  void* inData, size_t inDataSize, void* outData, size_t outDataBufferSize,
57  size_t& outDataActualSize);
58 
59 /** Decompress an array of bytes into another one
60  * \exception std::exception If the apriori estimated decompressed size is not
61  * enought
62  */
63 void decompress(
64  mrpt::utils::CStream& inStream, size_t inDataSize, void* outData,
65  size_t outDataBufferSize, size_t& outDataActualSize);
66 
67 /** Decompress a gzip file (xxxx.gz) into a memory buffer. If the file is not a
68  * .gz file, it just read the whole file unmodified.
69  * \return true on success, false on error.
70  * \sa compress_gz_file, decompress_gz_data_block
71  */
72 bool decompress_gz_file(const std::string& file_path, vector_byte& buffer);
73 
74 /** Compress a memory buffer into a gzip file (xxxx.gz).
75  * compress_level: 0=no compression, 1=best speed, 9=maximum
76  * \return true on success, false on error.
77  * \sa decompress_gz_file, compress_gz_data_block
78  */
79 bool compress_gz_file(
80  const std::string& file_path, const vector_byte& buffer,
81  const int compress_level = 9);
82 
83 /** Compress a memory buffer in gz-file format and return it as a block a
84  * memory.
85  * compress_level: 0=no compression, 1=best speed, 9=maximum
86  * \return true on success, false on error.
87  * \note If in_data is empty, an empty buffer is returned in out_gz_data and no
88  * error is reported.
89  * \sa compress_gz_file, de
90  */
92  const vector_byte& in_data, vector_byte& out_gz_data,
93  const int compress_level = 9);
94 
95 /** Decompress an array of bytes storing a gz-compressed stream of data into a
96  * memory buffer. If the input data is not recognized as a .gz file, the output
97  * data will be an exact copy of the input.
98  * \return true on success, false on error.
99  * \sa decompress_gz_file, compress_gz_data_block
100  */
102  const vector_byte& in_gz_data, vector_byte& out_data);
103 
104 } // End of namespace
105 } // End of namespace
106 
107 } // End of namespace
108 
109 #endif
std::vector< uint8_t > vector_byte
Definition: types_simple.h:27
GLuint buffer
Definition: glext.h:3917
bool 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...
Definition: zip.cpp:378
This base class is used to provide a unified interface to files,memory buffers,..Please see the deriv...
Definition: CStream.h:41
bool decompress_gz_file(const std::string &file_path, vector_byte &buffer)
Decompress a gzip file (xxxx.gz) into a memory buffer.
Definition: zip.cpp:211
void compress(const std::vector< unsigned char > &inData, mrpt::utils::CStream &out)
Compress an array of bytes and write the result into a stream.
Definition: zip.cpp:110
GLsizei const GLchar ** string
Definition: glext.h:4101
This is the global namespace for all Mobile Robot Programming Toolkit (MRPT) libraries.
bool 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).
Definition: zip.cpp:239
void compress(void *inData, size_t inDataSize, std::vector< unsigned char > &outData)
Compress an array of bytes into another one.
Definition: zip.cpp:36
void decompress(void *inData, size_t inDataSize, std::vector< unsigned char > &outData, size_t outDataEstimatedSize)
Decompress an array of bytes into another one.
Definition: zip.cpp:137
bool 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.
Definition: zip.cpp:272



Page generated by Doxygen 1.8.14 for MRPT 1.9.9 Git: ae4571287 Thu Nov 23 00:06:53 2017 +0100 at dom oct 27 23:51:55 CET 2019