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

vtkVoidArray.h

Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Program:   Visualization Toolkit
00004   Module:    $RCSfile: vtkVoidArray.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 =========================================================================*/
00037 #ifndef __vtkVoidArray_h
00038 #define __vtkVoidArray_h
00039 
00040 #include "vtkObject.h"
00041 
00042 class VTK_COMMON_EXPORT vtkVoidArray : public vtkObject
00043 {
00044 public:
00046   static vtkVoidArray *New();
00047 
00048   vtkTypeRevisionMacro(vtkVoidArray,vtkObject);
00049   void PrintSelf(ostream& os, vtkIndent indent);
00050 
00053   int Allocate(vtkIdType sz, vtkIdType ext=1000);
00054 
00056   void Initialize();
00057 
00059   int GetDataType() {return VTK_VOID;}
00060   
00062   int GetDataTypeSize() { return sizeof(void*); }
00063   
00065 
00066   void SetNumberOfPointers(vtkIdType number)
00067     {this->Allocate(number); this->NumberOfPointers = number;}
00069 
00071 
00072   vtkIdType GetNumberOfPointers()
00073     {return this->NumberOfPointers;}
00075 
00077 
00078   void* GetVoidPointer(vtkIdType id)
00079     {return this->Array[id];}
00081 
00083 
00084   void SetVoidPointer(vtkIdType id, void* ptr)
00085     {this->Array[id] = ptr;}
00087 
00090   void InsertVoidPointer(vtkIdType i, void* ptr);
00091 
00094   vtkIdType InsertNextVoidPointer(void* tuple);
00095 
00097 
00099   void Reset()
00100     {this->NumberOfPointers = 0;}
00102 
00104 
00106   void Squeeze() 
00107     {this->ResizeAndExtend (this->NumberOfPointers);}
00109 
00112   void** GetPointer(vtkIdType id) {return this->Array + id;}
00113 
00117   void** WritePointer(vtkIdType id, vtkIdType number);
00118   
00120   void DeepCopy(vtkVoidArray *va);
00121   
00122 protected:
00123   vtkVoidArray();
00124   ~vtkVoidArray();
00125 
00126   vtkIdType NumberOfPointers;
00127   vtkIdType Size; 
00128   void**    Array;  // pointer to data
00129 
00130   void** ResizeAndExtend(vtkIdType sz);  // function to resize data
00131 
00132 private:
00133   vtkVoidArray(const vtkVoidArray&);  // Not implemented.
00134   void operator=(const vtkVoidArray&);  // Not implemented.
00135 };
00136 
00137 
00138 #endif