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

bzip2compression.h
1 /* file: bzip2compression.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 bzip2 compression and decompression interface.
45 //--
46 */
47 
48 #ifndef __BZIP2COMPRESSION_H__
49 #define __BZIP2COMPRESSION_H__
50 #include "data_management/compression/compression.h"
51 
52 namespace daal
53 {
59 namespace data_management
60 {
61 
62 namespace interface1
63 {
80 /* [Bzip2CompressionParameter source code] */
81 class DAAL_EXPORT Bzip2CompressionParameter : public data_management::CompressionParameter
82 {
83 public:
89  Bzip2CompressionParameter( CompressionLevel clevel = defaultLevel ) :
90  data_management::CompressionParameter(clevel)
91  {}
92  ~Bzip2CompressionParameter() {}
93 };
94 /* [Bzip2CompressionParameter source code] */
95 
106 template<> class DAAL_EXPORT Compressor<bzip2> : public data_management::CompressorImpl
107 {
108 public:
112  Compressor();
113  ~Compressor();
120  void setInputDataBlock( byte *inBlock, size_t size, size_t offset );
125  void setInputDataBlock( DataBlock &inBlock )
126  {
127  return setInputDataBlock( inBlock.getPtr(), inBlock.getSize(), 0 );
128  }
135  void run( byte *outBlock, size_t size, size_t offset );
140  void run( DataBlock &outBlock )
141  {
142  run( outBlock.getPtr(), outBlock.getSize(), 0 );
143  }
144 
145  Bzip2CompressionParameter parameter;
147 protected:
148  void initialize();
149 
150 private:
151  void *_strmp;
152  int _flush;
153  int _blockSize100k;
154  size_t _comprLen;
155  size_t _comprLenLeft;
156  size_t _comprBlockThres;
157  byte * _startAddr;
158 
159  void finalizeCompression();
160  void resetCompression();
161  void checkBZipError(int error);
162 };
163 
174 template<> class DAAL_EXPORT Decompressor<bzip2> : public data_management::DecompressorImpl
175 {
176 public:
180  Decompressor();
181  ~Decompressor();
188  void setInputDataBlock( byte *inBlock, size_t size, size_t offset );
193  void setInputDataBlock( DataBlock &inBlock )
194  {
195  setInputDataBlock( inBlock.getPtr(), inBlock.getSize(), 0 );
196  }
203  void run( byte *outBlock, size_t size, size_t offset );
208  void run( DataBlock &outBlock )
209  {
210  run( outBlock.getPtr(), outBlock.getSize(), 0 );
211  }
212 
213  Bzip2CompressionParameter parameter;
215 protected:
216  void initialize();
217 
218 private:
219  void *_strmp;
220 
221  void finalizeCompression();
222  void resetCompression();
223  void checkBZipError(int error);
224 
225 };
226 } // namespace interface1
227 using interface1::Bzip2CompressionParameter;
228 using interface1::Compressor;
229 using interface1::Decompressor;
230 
231 } //namespace data_management
233 } //namespace daal
234 #endif //__BZIP2COMPRESSION_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::data_management::interface1::Bzip2CompressionParameter
Parameter for bzip2 compression and decompression.
Definition: bzip2compression.h:81
daal
Definition: algorithm_base_common.h:57
daal::data_management::interface1::Bzip2CompressionParameter::Bzip2CompressionParameter
Bzip2CompressionParameter(CompressionLevel clevel=defaultLevel)
Definition: bzip2compression.h:89
daal::data_management::CompressionLevel
CompressionLevel
Compression levels
Definition: compression.h:68
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::DataBlock::getSize
virtual size_t getSize() const DAAL_C11_OVERRIDE
Definition: data_block.h:159
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::Compressor< bzip2 >::run
void run(DataBlock &outBlock)
Definition: bzip2compression.h:140
daal::data_management::interface1::CompressionParameter
Parameters for compression and decompression.
Definition: compression.h:111
daal::data_management::bzip2
Definition: compression.h:93
daal::data_management::interface1::Compressor< bzip2 >::setInputDataBlock
void setInputDataBlock(DataBlock &inBlock)
Definition: bzip2compression.h:125
daal::data_management::interface1::DecompressorImpl
Base class for the Decompressor.
Definition: compression.h:277
daal::data_management::interface1::Compressor< bzip2 >::parameter
Bzip2CompressionParameter parameter
Definition: bzip2compression.h:145
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.