33 template <
class ScalarTypeT>
95 void operator=(
const vtkBuffer&) =
delete;
98 template <
class ScalarT>
105 template <
typename ScalarT>
108 if (this->Pointer != array)
110 if (this->DeleteFunction)
112 this->DeleteFunction(this->Pointer);
114 this->Pointer = array;
119 template <
typename ScalarT>
124 this->DeleteFunction =
nullptr;
128 this->DeleteFunction = deleteFunction;
133 template <
typename ScalarT>
137 this->SetBuffer(
nullptr, 0);
143 this->SetBuffer(newArray,
size);
144 this->DeleteFunction = free;
153 template <
typename ScalarT>
158 return this->Allocate(0);
161 if (this->Pointer && this->DeleteFunction != free)
168 std::copy(this->Pointer, this->Pointer + std::min(this->Size, newsize), newArray);
170 this->SetBuffer(newArray, newsize);
171 this->DeleteFunction = free;
183 this->Pointer = newArray;
184 this->Size = newsize;
internal storage class used by vtkSOADataArrayTemplate, vtkAOSDataArrayTemplate, and others.
bool Reallocate(vtkIdType newsize)
Allocate a new buffer that holds newsize elements.
void SetFreeFunction(bool noFreeFunction, void(*deleteFunction)(void *)=free)
Set the free function to be used when releasing this object.
const ScalarType * GetBuffer() const
void(* DeleteFunction)(void *)
vtkIdType GetSize() const
Return the number of elements the current buffer can hold.
ScalarType * GetBuffer()
Access the buffer as a scalar pointer.
vtkTemplateTypeMacro(vtkBuffer< ScalarTypeT >, vtkObject)
bool Allocate(vtkIdType size)
Allocate a new buffer that holds size elements.
static vtkBuffer< ScalarTypeT > * New()
void SetBuffer(ScalarType *array, vtkIdType size)
Set the memory buffer that this vtkBuffer object will manage.
abstract base class for most VTK objects
#define VTK_STANDARD_NEW_BODY(thisClass)