C++ API Reference for Intel® Data Analytics Acceleration Library 2018 Update 2

rlecompression.h
1 /* file: rlecompression.h */
2 /*******************************************************************************
3 * Copyright 2014-2018 Intel Corporation
4 * All Rights Reserved.
5 *
6 * If this software was obtained under the Intel Simplified Software License,
7 * the following terms apply:
8 *
9 * The source code, information and material ("Material") contained herein is
10 * owned by Intel Corporation or its suppliers or licensors, and title to such
11 * Material remains with Intel Corporation or its suppliers or licensors. The
12 * Material contains proprietary information of Intel or its suppliers and
13 * licensors. The Material is protected by worldwide copyright laws and treaty
14 * provisions. No part of the Material may be used, copied, reproduced,
15 * modified, published, uploaded, posted, transmitted, distributed or disclosed
16 * in any way without Intel's prior express written permission. No license under
17 * any patent, copyright or other intellectual property rights in the Material
18 * is granted to or conferred upon you, either expressly, by implication,
19 * inducement, estoppel or otherwise. Any license under such intellectual
20 * property rights must be express and approved by Intel in writing.
21 *
22 * Unless otherwise agreed by Intel in writing, you may not remove or alter this
23 * notice or any other notice embedded in Materials by Intel or Intel's
24 * suppliers or licensors in any way.
25 *
26 *
27 * If this software was obtained under the Apache License, Version 2.0 (the
28 * "License"), the following terms apply:
29 *
30 * You may not use this file except in compliance with the License. You may
31 * obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
32 *
33 *
34 * Unless required by applicable law or agreed to in writing, software
35 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
36 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
37 *
38 * See the License for the specific language governing permissions and
39 * limitations under the License.
40 *******************************************************************************/
41 
42 /*
43 //++
44 // Implementation of the run-length encoding interface.
45 //--
46 */
47 
48 #ifndef __RLECOMPRESSION_H__
49 #define __RLECOMPRESSION_H__
50 #include "data_management/compression/compression.h"
51 
52 namespace daal
53 {
54 namespace data_management
55 {
56 
57 namespace interface1
58 {
72 /* [RleCompressionParameter source code] */
73 class DAAL_EXPORT RleCompressionParameter : public data_management::CompressionParameter
74 {
75 public:
80  RleCompressionParameter(bool _isBlockHeader = 1) :
81  data_management::CompressionParameter(defaultLevel), isBlockHeader(_isBlockHeader) {}
82 
83  ~RleCompressionParameter() {}
84 
85  bool isBlockHeader;
86 };
87 /* [RleCompressionParameter source code] */
88 
99 template<> class DAAL_EXPORT Compressor<rle> : public data_management::CompressorImpl
100 {
101 public:
105  Compressor();
106  ~Compressor();
113  void setInputDataBlock( byte *inBlock, size_t size, size_t offset );
118  void setInputDataBlock( DataBlock &inBlock )
119  {
120  setInputDataBlock( inBlock.getPtr(), inBlock.getSize(), 0 );
121  }
122 
129  void run( byte *outBlock, size_t size, size_t offset );
134  void run( DataBlock &outBlock )
135  {
136  run( outBlock.getPtr(), outBlock.getSize(), 0 );
137  }
138 
139  RleCompressionParameter parameter;
141 protected:
142  void initialize();
143 
144 private:
145  void *_next_in;
146  size_t _avail_in;
147  void *_next_out;
148  size_t _avail_out;
149  size_t _headBytes;
150 
151  void finalizeCompression();
152 };
153 
164 template<> class DAAL_EXPORT Decompressor<rle> : public data_management::DecompressorImpl
165 {
166 public:
170  Decompressor();
171  ~Decompressor();
178  void setInputDataBlock( byte *inBlock, size_t size, size_t offset );
183  void setInputDataBlock( DataBlock &inBlock )
184  {
185  setInputDataBlock( inBlock.getPtr(), inBlock.getSize(), 0 );
186  }
193  void run( byte *outBlock, size_t size, size_t offset );
198  void run( DataBlock &outBlock )
199  {
200  run( outBlock.getPtr(), outBlock.getSize(), 0 );
201  }
202 
203  RleCompressionParameter parameter;
205 protected:
206  void initialize();
207 
208 private:
209  void *_next_in;
210  size_t _avail_in;
211  void *_next_out;
212  size_t _avail_out;
213  size_t _headBytes;
214 
215  void *_internalBuff;
216  size_t _internalBuffOff;
217  size_t _internalBuffLen;
218 
219  void finalizeCompression();
220 };
222 } // namespace interface1
223 using interface1::RleCompressionParameter;
224 using interface1::Compressor;
225 using interface1::Decompressor;
226 
227 } //namespace data_management
228 } //namespace daal
229 #endif //__RLECOMPRESSION_H
daal::data_management::interface1::Compressor
Compressor class compresses an input data block and writes results into an output data block...
Definition: compression.h:307
daal
Definition: algorithm_base_common.h:57
daal::data_management::interface1::RleCompressionParameter::RleCompressionParameter
RleCompressionParameter(bool _isBlockHeader=1)
Definition: rlecompression.h:80
daal::data_management::interface1::RleCompressionParameter::isBlockHeader
bool isBlockHeader
Definition: rlecompression.h:85
daal::data_management::interface1::Decompressor< rle >::parameter
RleCompressionParameter parameter
Definition: rlecompression.h:203
daal::data_management::defaultLevel
Definition: compression.h:70
daal::data_management::interface1::DataBlock::getPtr
virtual byte * getPtr() const DAAL_C11_OVERRIDE
Definition: data_block.h:149
daal::data_management::interface1::CompressorImpl
Base class for the Compressor.
Definition: compression.h:251
daal::data_management::interface1::RleCompressionParameter
Parameter for run-length encoding and decoding. A RLE encoded block may contain a header that consist...
Definition: rlecompression.h:73
daal::data_management::interface1::DataBlock::getSize
virtual size_t getSize() const DAAL_C11_OVERRIDE
Definition: data_block.h:159
daal::data_management::rle
Definition: compression.h:92
daal::data_management::interface1::Compressor< rle >::parameter
RleCompressionParameter parameter
Definition: rlecompression.h:139
daal::data_management::interface1::Decompressor
Decompressor class decompresses an input data block and writes results into an output data block...
Definition: compression.h:329
daal::data_management::interface1::CompressionParameter
Parameters for compression and decompression.
Definition: compression.h:111
daal::data_management::interface1::Decompressor< rle >::setInputDataBlock
void setInputDataBlock(DataBlock &inBlock)
Definition: rlecompression.h:183
daal::data_management::interface1::DecompressorImpl
Base class for the Decompressor.
Definition: compression.h:277
daal::data_management::interface1::Compressor< rle >::run
void run(DataBlock &outBlock)
Definition: rlecompression.h:134
daal::data_management::interface1::Compressor< rle >::setInputDataBlock
void setInputDataBlock(DataBlock &inBlock)
Definition: rlecompression.h:118
daal::data_management::interface1::Decompressor< rle >::run
void run(DataBlock &outBlock)
Definition: rlecompression.h:198
daal::data_management::interface1::DataBlock
Class that stores a pointer to a byte array and its size. Not responsible for memory management...
Definition: data_block.h:109

For more complete information about compiler optimizations, see our Optimization Notice.