VTK  9.0.1
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:
48  vtkTypeMacro(vtkDataCompressor, vtkObject);
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, size_t uncompressedSize,
66  unsigned char* compressedData, size_t compressionSpace);
67 
74  size_t Uncompress(unsigned char const* compressedData, size_t compressedSize,
75  unsigned char* uncompressedData, size_t uncompressedSize);
76 
81  vtkUnsignedCharArray* Compress(unsigned char const* uncompressedData, size_t uncompressedSize);
82 
90  vtkUnsignedCharArray* Uncompress(
91  unsigned char const* compressedData, size_t compressedSize, size_t uncompressedSize);
92 
99  virtual void SetCompressionLevel(int compressionLevel) = 0;
100  virtual int GetCompressionLevel() = 0;
101 
102 protected:
104  ~vtkDataCompressor() override;
105 
106  // Actual compression method. This must be provided by a subclass.
107  // Must return the size of the compressed data, or zero on error.
108  virtual size_t CompressBuffer(unsigned char const* uncompressedData, size_t uncompressedSize,
109  unsigned char* compressedData, size_t compressionSpace) = 0;
110  // Actual decompression method. This must be provided by a subclass.
111  // Must return the size of the uncompressed data, or zero on error.
112  virtual size_t UncompressBuffer(unsigned char const* compressedData, size_t compressedSize,
113  unsigned char* uncompressedData, size_t uncompressedSize) = 0;
114 
115 private:
116  vtkDataCompressor(const vtkDataCompressor&) = delete;
117  void operator=(const vtkDataCompressor&) = delete;
118 };
119 
120 #endif
abstract base class for most VTK objects
Definition: vtkObject.h:62
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:33
dynamic, self-adjusting array of unsigned char