Main Page | Class Hierarchy | Alphabetical List | Class List | File List | Class Members | File Members | Related Pages

IO/vtkDataCompressor.h

Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Program:   Visualization Toolkit
00004   Module:    $RCSfile: vtkDataCompressor.h,v $
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 "vtkObject.h"
00028 
00029 class vtkUnsignedCharArray;
00030 
00031 class VTK_IO_EXPORT vtkDataCompressor : public vtkObject
00032 {
00033 public:
00034   vtkTypeRevisionMacro(vtkDataCompressor,vtkObject);
00035   void PrintSelf(ostream& os, vtkIndent indent);
00036   
00041   virtual unsigned long GetMaximumCompressionSpace(unsigned long size)=0;
00042   
00044 
00047   unsigned long Compress(const unsigned char* uncompressedData,
00048                          unsigned long uncompressedSize,
00049                          unsigned char* compressedData,
00050                          unsigned long compressionSpace);
00052   
00054 
00057   unsigned long Uncompress(const unsigned char* compressedData,
00058                            unsigned long compressedSize,
00059                            unsigned char* uncompressedData,
00060                            unsigned long uncompressedSize);
00062   
00064 
00066   vtkUnsignedCharArray* Compress(const unsigned char* uncompressedData,
00067                                  unsigned long uncompressedSize);
00069   
00071 
00075   vtkUnsignedCharArray* Uncompress(const unsigned char* compressedData,
00076                                    unsigned long compressedSize,
00077                                    unsigned long uncompressedSize);
00079 protected:
00080   vtkDataCompressor();
00081   ~vtkDataCompressor();
00082   
00083   // Actual compression method.  This must be provided by a subclass.
00084   // Must return the size of the compressed data, or zero on error.
00085   virtual unsigned long CompressBuffer(const unsigned char* uncompressedData,
00086                                        unsigned long uncompressedSize,
00087                                        unsigned char* compressedData,
00088                                        unsigned long compressionSpace)=0;  
00089   // Actual decompression method.  This must be provided by a subclass.
00090   // Must return the size of the uncompressed data, or zero on error.
00091   virtual unsigned long UncompressBuffer(const unsigned char* compressedData,
00092                                          unsigned long compressedSize,
00093                                          unsigned char* uncompressedData,
00094                                          unsigned long uncompressedSize)=0;
00095 private:
00096   vtkDataCompressor(const vtkDataCompressor&);  // Not implemented.
00097   void operator=(const vtkDataCompressor&);  // Not implemented.
00098 };
00099 
00100 #endif