Common/vtkVoidArray.h
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00023 #ifndef __vtkVoidArray_h
00024 #define __vtkVoidArray_h
00025
00026 #include "vtkObject.h"
00027
00028 class VTK_COMMON_EXPORT vtkVoidArray : public vtkObject
00029 {
00030 public:
00032 static vtkVoidArray *New();
00033
00034 vtkTypeRevisionMacro(vtkVoidArray,vtkObject);
00035 void PrintSelf(ostream& os, vtkIndent indent);
00036
00039 int Allocate(vtkIdType sz, vtkIdType ext=1000);
00040
00042 void Initialize();
00043
00045 int GetDataType() {return VTK_VOID;}
00046
00048 int GetDataTypeSize() { return sizeof(void*); }
00049
00051
00052 void SetNumberOfPointers(vtkIdType number)
00053 {this->Allocate(number); this->NumberOfPointers = number;}
00055
00057
00058 vtkIdType GetNumberOfPointers()
00059 {return this->NumberOfPointers;}
00061
00063
00064 void* GetVoidPointer(vtkIdType id)
00065 {return this->Array[id];}
00067
00069
00070 void SetVoidPointer(vtkIdType id, void* ptr)
00071 {this->Array[id] = ptr;}
00073
00076 void InsertVoidPointer(vtkIdType i, void* ptr);
00077
00080 vtkIdType InsertNextVoidPointer(void* tuple);
00081
00083
00085 void Reset()
00086 {this->NumberOfPointers = 0;}
00088
00090
00092 void Squeeze()
00093 {this->ResizeAndExtend (this->NumberOfPointers);}
00095
00098 void** GetPointer(vtkIdType id) {return this->Array + id;}
00099
00103 void** WritePointer(vtkIdType id, vtkIdType number);
00104
00106 void DeepCopy(vtkVoidArray *va);
00107
00108 protected:
00109 vtkVoidArray();
00110 ~vtkVoidArray();
00111
00112 vtkIdType NumberOfPointers;
00113 vtkIdType Size;
00114 void** Array;
00115
00116 void** ResizeAndExtend(vtkIdType sz);
00117
00118 private:
00119 vtkVoidArray(const vtkVoidArray&);
00120 void operator=(const vtkVoidArray&);
00121 };
00122
00123
00124 #endif