VTK  9.4.20241222
vtkDataCompressor.h
Go to the documentation of this file.
1// SPDX-FileCopyrightText: Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
2// SPDX-License-Identifier: BSD-3-Clause
25#ifndef vtkDataCompressor_h
26#define vtkDataCompressor_h
27
28#include "vtkIOCoreModule.h" // For export macro
29#include "vtkObject.h"
30
31VTK_ABI_NAMESPACE_BEGIN
33
34class VTKIOCORE_EXPORT vtkDataCompressor : public vtkObject
35{
36public:
38 void PrintSelf(ostream& os, vtkIndent indent) override;
39
46 virtual size_t GetMaximumCompressionSpace(size_t size) = 0;
47
54 size_t Compress(unsigned char const* uncompressedData, size_t uncompressedSize,
55 unsigned char* compressedData, size_t compressionSpace);
56
63 size_t Uncompress(unsigned char const* compressedData, size_t compressedSize,
64 unsigned char* uncompressedData, size_t uncompressedSize);
65
70 vtkUnsignedCharArray* Compress(unsigned char const* uncompressedData, size_t uncompressedSize);
71
80 unsigned char const* compressedData, size_t compressedSize, size_t uncompressedSize);
81
88 virtual void SetCompressionLevel(int compressionLevel) = 0;
89 virtual int GetCompressionLevel() = 0;
90
91protected:
94
95 // Actual compression method. This must be provided by a subclass.
96 // Must return the size of the compressed data, or zero on error.
97 virtual size_t CompressBuffer(unsigned char const* uncompressedData, size_t uncompressedSize,
98 unsigned char* compressedData, size_t compressionSpace) = 0;
99 // Actual decompression method. This must be provided by a subclass.
100 // Must return the size of the uncompressed data, or zero on error.
101 virtual size_t UncompressBuffer(unsigned char const* compressedData, size_t compressedSize,
102 unsigned char* uncompressedData, size_t uncompressedSize) = 0;
103
104private:
105 vtkDataCompressor(const vtkDataCompressor&) = delete;
106 void operator=(const vtkDataCompressor&) = delete;
107};
108
109VTK_ABI_NAMESPACE_END
110#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:108
abstract base class for most VTK objects
Definition vtkObject.h:162
dynamic, self-adjusting array of unsigned char