Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound 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   Language:  C++
00006 
00007   Copyright (c) 1993-2002 Ken Martin, Will Schroeder, Bill Lorensen 
00008   All rights reserved.
00009   See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
00010 
00011      This software is distributed WITHOUT ANY WARRANTY; without even 
00012      the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 
00013      PURPOSE.  See the above copyright notice for more information.
00014 
00015 =========================================================================*/
00038 #ifndef __vtkDataCompressor_h
00039 #define __vtkDataCompressor_h
00040 
00041 #include "vtkObject.h"
00042 
00043 class vtkUnsignedCharArray;
00044 
00045 class VTK_IO_EXPORT vtkDataCompressor : public vtkObject
00046 {
00047 public:
00048   vtkTypeRevisionMacro(vtkDataCompressor,vtkObject);
00049   void PrintSelf(ostream& os, vtkIndent indent);
00050   
00055   virtual unsigned long GetMaximumCompressionSpace(unsigned long size)=0;
00056   
00058 
00061   unsigned long Compress(const unsigned char* uncompressedData,
00062                          unsigned long uncompressedSize,
00063                          unsigned char* compressedData,
00064                          unsigned long compressionSpace);
00066   
00068 
00071   unsigned long Uncompress(const unsigned char* compressedData,
00072                            unsigned long compressedSize,
00073                            unsigned char* uncompressedData,
00074                            unsigned long uncompressedSize);
00076   
00078 
00080   vtkUnsignedCharArray* Compress(const unsigned char* uncompressedData,
00081                                  unsigned long uncompressedSize);
00083   
00085 
00089   vtkUnsignedCharArray* Uncompress(const unsigned char* compressedData,
00090                                    unsigned long compressedSize,
00091                                    unsigned long uncompressedSize);
00093 protected:
00094   vtkDataCompressor();
00095   ~vtkDataCompressor();
00096   
00097   // Actual compression method.  This must be provided by a subclass.
00098   // Must return the size of the compressed data, or zero on error.
00099   virtual unsigned long CompressBuffer(const unsigned char* uncompressedData,
00100                                        unsigned long uncompressedSize,
00101                                        unsigned char* compressedData,
00102                                        unsigned long compressionSpace)=0;  
00103   // Actual decompression method.  This must be provided by a subclass.
00104   // Must return the size of the uncompressed data, or zero on error.
00105   virtual unsigned long UncompressBuffer(const unsigned char* compressedData,
00106                                          unsigned long compressedSize,
00107                                          unsigned char* uncompressedData,
00108                                          unsigned long uncompressedSize)=0;
00109 private:
00110   vtkDataCompressor(const vtkDataCompressor&);  // Not implemented.
00111   void operator=(const vtkDataCompressor&);  // Not implemented.
00112 };
00113 
00114 #endif