VTK  9.1.0
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
45class VTKIOCORE_EXPORT vtkDataCompressor : public vtkObject
46{
47public:
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
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
102protected:
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
115private:
116 vtkDataCompressor(const vtkDataCompressor&) = delete;
117 void operator=(const vtkDataCompressor&) = delete;
118};
119
120#endif
Abstract interface for data compression classes.
virtual size_t UncompressBuffer(unsigned char const *compressedData, size_t compressedSize, unsigned char *uncompressedData, size_t uncompressedSize)=0
vtkUnsignedCharArray * Compress(unsigned char const *uncompressedData, size_t uncompressedSize)
Compress the given data.
size_t Uncompress(unsigned char const *compressedData, size_t compressedSize, unsigned char *uncompressedData, size_t uncompressedSize)
Uncompress the given input data into the given output buffer.
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
virtual size_t CompressBuffer(unsigned char const *uncompressedData, size_t uncompressedSize, unsigned char *compressedData, size_t compressionSpace)=0
~vtkDataCompressor() override
virtual void SetCompressionLevel(int compressionLevel)=0
Compression performance varies greatly with compression level Require level setting from any vtkDataC...
vtkUnsignedCharArray * Uncompress(unsigned char const *compressedData, size_t compressedSize, size_t uncompressedSize)
Uncompress the given data.
virtual int GetCompressionLevel()=0
virtual size_t GetMaximumCompressionSpace(size_t size)=0
Get the maximum space that may be needed to store data of the given uncompressed size after compressi...
size_t Compress(unsigned char const *uncompressedData, size_t uncompressedSize, unsigned char *compressedData, size_t compressionSpace)
Compress the given input data buffer into the given output buffer.
a simple class to control print indentation
Definition: vtkIndent.h:113
abstract base class for most VTK objects
Definition: vtkObject.h:82
dynamic, self-adjusting array of unsigned char