VTK
vtkVoidArray.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Visualization Toolkit
4  Module: vtkVoidArray.h
5 
6  Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
7  All rights reserved.
8  See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
9 
10  This software is distributed WITHOUT ANY WARRANTY; without even
11  the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
12  PURPOSE. See the above copyright notice for more information.
13 
14 =========================================================================*/
23 #ifndef __vtkVoidArray_h
24 #define __vtkVoidArray_h
25 
26 #include "vtkCommonCoreModule.h" // For export macro
27 #include "vtkObject.h"
28 
29 class VTKCOMMONCORE_EXPORT vtkVoidArray : public vtkObject
30 {
31 public:
33  static vtkVoidArray *New();
34 
35  vtkTypeMacro(vtkVoidArray,vtkObject);
36  void PrintSelf(ostream& os, vtkIndent indent);
37 
40  int Allocate(vtkIdType sz, vtkIdType ext=1000);
41 
43  void Initialize();
44 
46  int GetDataType() {return VTK_VOID;}
47 
49  int GetDataTypeSize() { return sizeof(void*); }
50 
52 
53  void SetNumberOfPointers(vtkIdType number)
54  {this->Allocate(number); this->NumberOfPointers = number;}
56 
58 
59  vtkIdType GetNumberOfPointers()
60  {return this->NumberOfPointers;}
62 
64 
65  void* GetVoidPointer(vtkIdType id)
66  {return this->Array[id];}
68 
70 
71  void SetVoidPointer(vtkIdType id, void* ptr)
72  {this->Array[id] = ptr;}
74 
77  void InsertVoidPointer(vtkIdType i, void* ptr);
78 
81  vtkIdType InsertNextVoidPointer(void* tuple);
82 
84 
86  void Reset()
87  {this->NumberOfPointers = 0;}
89 
91 
93  void Squeeze()
94  {this->ResizeAndExtend (this->NumberOfPointers);}
96 
99  void** GetPointer(vtkIdType id) {return this->Array + id;}
100 
104  void** WritePointer(vtkIdType id, vtkIdType number);
105 
107  void DeepCopy(vtkVoidArray *va);
108 
109 protected:
110  vtkVoidArray();
111  ~vtkVoidArray();
112 
115  void** Array; // pointer to data
116 
117  void** ResizeAndExtend(vtkIdType sz); // function to resize data
118 
119 private:
120  vtkVoidArray(const vtkVoidArray&); // Not implemented.
121  void operator=(const vtkVoidArray&); // Not implemented.
122 };
123 
124 
125 #endif