33 template <
class ScalarTypeT>
61 void SetFreeFunction(
bool noFreeFunction,
void (*deleteFunction)(
void*) = free);
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;
static vtkBuffer< ScalarTypeT > * New()
vtkIdType GetSize() const
Return the number of elements the current buffer can hold.
const ScalarType * GetBuffer() const
abstract base class for most VTK objects
void SetFreeFunction(bool noFreeFunction, void(*deleteFunction)(void *)=free)
Set the free function to be used when releasing this object.
internal storage class used by vtkSOADataArrayTemplate, vtkAOSDataArrayTemplate, and others...
ScalarType * GetBuffer()
Access the buffer as a scalar pointer.
void SetBuffer(ScalarType *array, vtkIdType size)
Set the memory buffer that this vtkBuffer object will manage.
bool Reallocate(vtkIdType newsize)
Allocate a new buffer that holds newsize elements.
void(* DeleteFunction)(void *)
bool Allocate(vtkIdType size)
Allocate a new buffer that holds size elements.
#define VTK_STANDARD_NEW_BODY(thisClass)
vtkTemplateTypeMacro(vtkBuffer< ScalarTypeT >, vtkObject)