VTK  9.6.20260228
vtkVoidArray.h
Go to the documentation of this file.
1// SPDX-FileCopyrightText: Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
2// SPDX-License-Identifier: BSD-3-Clause
11
12#ifndef vtkVoidArray_h
13#define vtkVoidArray_h
14
15#include "vtkCommonCoreModule.h" // For export macro
16#include "vtkDeprecation.h" // For VTK_DEPRECATED_IN_9_7_0
17#include "vtkObject.h"
18
19VTK_ABI_NAMESPACE_BEGIN
20class VTK_DEPRECATED_IN_9_7_0("No longer needed") VTKCOMMONCORE_EXPORT vtkVoidArray
21 : public vtkObject
22{
23public:
27 static vtkVoidArray* New();
29
30 vtkTypeMacro(vtkVoidArray, vtkObject);
31 void PrintSelf(ostream& os, vtkIndent indent) override;
32
38
42 void Initialize();
43
47 int GetDataType() const { return VTK_VOID; }
48
52 int GetDataTypeSize() { return sizeof(void*); }
53
58 {
59 this->Allocate(number);
60 this->NumberOfPointers = number;
61 }
62
67
71 void* GetVoidPointer(vtkIdType id) { return this->Array[id]; }
72
76 void SetVoidPointer(vtkIdType id, void* ptr) { this->Array[id] = ptr; }
77
82 void InsertVoidPointer(vtkIdType i, void* ptr);
83
89
94 void Reset() { this->NumberOfPointers = 0; }
95
99 void Squeeze() { this->ResizeAndExtend(this->NumberOfPointers); }
100
105 void** GetPointer(vtkIdType id) { return this->Array + id; }
106
112 void** WritePointer(vtkIdType id, vtkIdType number);
113
118
119protected:
121 ~vtkVoidArray() override;
122
125 void** Array; // pointer to data
126
127 void** ResizeAndExtend(vtkIdType sz); // function to resize data
128
129private:
130 vtkVoidArray(const vtkVoidArray&) = delete;
131 void operator=(const vtkVoidArray&) = delete;
132};
133
134VTK_ABI_NAMESPACE_END
135#endif
a simple class to control print indentation
Definition vtkIndent.h:108
vtkIdType InsertNextVoidPointer(void *tuple)
Insert (memory allocation performed) the void* pointer at the end of the array.
void ** GetPointer(vtkIdType id)
Get the address of a particular data index.
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
void Squeeze()
Resize the array to just fit the inserted memory.
static vtkVoidArray * New()
Initialize with empty array.
~vtkVoidArray() override
void ** ResizeAndExtend(vtkIdType sz)
void SetVoidPointer(vtkIdType id, void *ptr)
Set the void* pointer value at the ith location in the array.
void SetNumberOfPointers(vtkIdType number)
Set the number of void* pointers held in the array.
void Initialize()
Release storage and reset array to initial state.
void ** WritePointer(vtkIdType id, vtkIdType number)
Get the address of a particular data index.
vtkIdType GetNumberOfPointers()
Get the number of void* pointers held in the array.
vtkIdType NumberOfPointers
void InsertVoidPointer(vtkIdType i, void *ptr)
Insert (memory allocation performed) the void* into the ith location in the array.
void Reset()
Reuse already allocated data; make the container look like it is empty.
void DeepCopy(vtkVoidArray *va)
Deep copy of another void array.
void * GetVoidPointer(vtkIdType id)
Get the void* pointer at the ith location.
int GetDataType() const
Return the type of data.
vtkIdType Size
vtkTypeBool Allocate(vtkIdType sz, vtkIdType ext=1000)
Allocate memory for this array.
int GetDataTypeSize()
Return the size of the data contained in the array.
static vtkVoidArray * ExtendedNew()
int vtkTypeBool
Definition vtkABI.h:64
#define VTK_DEPRECATED_IN_9_7_0(reason)
int vtkIdType
Definition vtkType.h:363
#define VTK_VOID
Definition vtkType.h:32