VTK
dox/IO/Core/vtkDataCompressor.h
Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Program:   Visualization Toolkit
00004   Module:    vtkDataCompressor.h
00005 
00006   Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
00007   All rights reserved.
00008   See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
00009 
00010      This software is distributed WITHOUT ANY WARRANTY; without even
00011      the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
00012      PURPOSE.  See the above copyright notice for more information.
00013 
00014 =========================================================================*/
00024 #ifndef __vtkDataCompressor_h
00025 #define __vtkDataCompressor_h
00026 
00027 #include "vtkIOCoreModule.h" // For export macro
00028 #include "vtkObject.h"
00029 
00030 class vtkUnsignedCharArray;
00031 
00032 class VTKIOCORE_EXPORT vtkDataCompressor : public vtkObject
00033 {
00034 public:
00035   vtkTypeMacro(vtkDataCompressor,vtkObject);
00036   void PrintSelf(ostream& os, vtkIndent indent);
00037 
00042   virtual size_t GetMaximumCompressionSpace(size_t size)=0;
00043 
00045 
00048   size_t Compress(unsigned char const* uncompressedData,
00049                   size_t uncompressedSize,
00050                   unsigned char* compressedData,
00051                   size_t compressionSpace);
00053 
00055 
00058   size_t Uncompress(unsigned char const* compressedData,
00059                     size_t compressedSize,
00060                     unsigned char* uncompressedData,
00061                     size_t uncompressedSize);
00063 
00065 
00067   vtkUnsignedCharArray* Compress(unsigned char const* uncompressedData,
00068                                  size_t uncompressedSize);
00070 
00072 
00076   vtkUnsignedCharArray* Uncompress(unsigned char const* compressedData,
00077                                    size_t compressedSize,
00078                                    size_t uncompressedSize);
00079 protected:
00080   vtkDataCompressor();
00081   ~vtkDataCompressor();
00083 
00084   // Actual compression method.  This must be provided by a subclass.
00085   // Must return the size of the compressed data, or zero on error.
00086   virtual size_t CompressBuffer(unsigned char const* uncompressedData,
00087                                 size_t uncompressedSize,
00088                                 unsigned char* compressedData,
00089                                 size_t compressionSpace)=0;
00090   // Actual decompression method.  This must be provided by a subclass.
00091   // Must return the size of the uncompressed data, or zero on error.
00092   virtual size_t UncompressBuffer(unsigned char const* compressedData,
00093                                   size_t compressedSize,
00094                                   unsigned char* uncompressedData,
00095                                   size_t uncompressedSize)=0;
00096 private:
00097   vtkDataCompressor(const vtkDataCompressor&);  // Not implemented.
00098   void operator=(const vtkDataCompressor&);  // Not implemented.
00099 };
00100 
00101 #endif