VTK
vtkDataCompressor.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Visualization Toolkit
4  Module: vtkDataCompressor.h
5 
6  Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
7  All rights reserved.
8  See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
9 
10  This software is distributed WITHOUT ANY WARRANTY; without even
11  the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
12  PURPOSE. See the above copyright notice for more information.
13 
14 =========================================================================*/
37 #ifndef vtkDataCompressor_h
38 #define vtkDataCompressor_h
39 
40 #include "vtkIOCoreModule.h" // For export macro
41 #include "vtkObject.h"
42 
44 
45 class VTKIOCORE_EXPORT vtkDataCompressor : public vtkObject
46 {
47 public:
49  void PrintSelf(ostream& os, vtkIndent indent) override;
50 
57  virtual size_t GetMaximumCompressionSpace(size_t size)=0;
58 
65  size_t Compress(unsigned char const* uncompressedData,
66  size_t uncompressedSize,
67  unsigned char* compressedData,
68  size_t compressionSpace);
69 
76  size_t Uncompress(unsigned char const* compressedData,
77  size_t compressedSize,
78  unsigned char* uncompressedData,
79  size_t uncompressedSize);
80 
85  vtkUnsignedCharArray* Compress(unsigned char const* uncompressedData,
86  size_t uncompressedSize);
87 
95  vtkUnsignedCharArray* Uncompress(unsigned char const* compressedData,
96  size_t compressedSize,
97  size_t uncompressedSize);
98 
105  virtual void SetCompressionLevel(int compressionLevel) = 0;
106  virtual int GetCompressionLevel() = 0;
107 
108 protected:
110  ~vtkDataCompressor() override;
111 
112  // Actual compression method. This must be provided by a subclass.
113  // Must return the size of the compressed data, or zero on error.
114  virtual size_t CompressBuffer(unsigned char const* uncompressedData,
115  size_t uncompressedSize,
116  unsigned char* compressedData,
117  size_t compressionSpace)=0;
118  // Actual decompression method. This must be provided by a subclass.
119  // Must return the size of the uncompressed data, or zero on error.
120  virtual size_t UncompressBuffer(unsigned char const* compressedData,
121  size_t compressedSize,
122  unsigned char* uncompressedData,
123  size_t uncompressedSize)=0;
124 
125 
126 private:
127  vtkDataCompressor(const vtkDataCompressor&) = delete;
128  void operator=(const vtkDataCompressor&) = delete;
129 };
130 
131 #endif
abstract base class for most VTK objects
Definition: vtkObject.h:59
Abstract interface for data compression classes.
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
a simple class to control print indentation
Definition: vtkIndent.h:39
dynamic, self-adjusting array of unsigned char