29VTK_ABI_NAMESPACE_BEGIN
30template <
class ScalarTypeT>
124 void operator=(
const vtkBuffer&) =
delete;
127template <
class ScalarT>
133template <
class ScalarT>
141template <
typename ScalarT>
152 else if constexpr (std::is_trivially_destructible_v<ScalarT>)
158 vtkErrorMacro(
"SetBuffer is not supported for non-trivially destructible types with free.");
167template <
typename ScalarT>
173template <
typename ScalarT>
180template <
typename ScalarT>
194template <
typename ScalarT>
206 else if constexpr (std::is_trivially_constructible_v<ScalarType>)
212 vtkErrorMacro(
"Allocate is not supported for non-trivially constructible types with malloc.");
230template <
typename ScalarT>
233 if (!this->
Pointer || newsize == 0)
244 else if constexpr (std::is_trivially_constructible_v<ScalarType>)
251 "Reallocate is not supported for non-trivially constructible types with malloc.");
280 else if constexpr (std::is_trivially_copyable_v<ScalarType>)
286 vtkErrorMacro(
"Reallocate is not supported for non-trivially copyable types with realloc.");
294 this->
Size = newsize;
vtkAbstractBuffer()=default
bool Reallocate(vtkIdType newsize)
Allocate a new buffer that holds newsize elements.
ScalarType * GetBuffer()
Access the buffer as a scalar pointer.
vtkFreeingFunction DeleteFunction
vtkMallocingFunction MallocFunction
const ScalarType * GetBuffer() const
void * GetVoidBuffer() override
vtkAbstractBuffer interface implementation for Python buffer protocol support.
vtkTemplateTypeMacro(vtkBuffer< ScalarTypeT >, vtkAbstractBuffer)
void SetReallocFunction(vtkReallocingFunction reallocFunction=realloc)
Set the realloc function to be used when allocating space inside this object.
static vtkBuffer< ScalarTypeT > * ExtendedNew()
void SetMallocFunction(vtkMallocingFunction mallocFunction=malloc)
Set the malloc function to be used when allocating space inside this object.
vtkIdType GetSize() const
Return the number of elements the current buffer can hold.
int GetDataType() const override
vtkAbstractBuffer interface implementation for Python buffer protocol support.
int GetDataTypeSize() const override
vtkAbstractBuffer interface implementation for Python buffer protocol support.
vtkReallocingFunction ReallocFunction
bool Allocate(vtkIdType size)
Allocate a new buffer that holds size elements.
static vtkBuffer< ScalarTypeT > * New()
vtkIdType GetNumberOfElements() const override
vtkAbstractBuffer interface implementation for Python buffer protocol support.
void SetFreeFunction(bool noFreeFunction)
Set whether the buffer should be freed when this object is deleted or resized.
void SetFreeFunction(bool noFreeFunction, vtkFreeingFunction deleteFunction)
Set the free function to be used when releasing this object.
void SetBuffer(ScalarType *array, vtkIdType size)
Set the memory buffer that this vtkBuffer object will manage.
A class to help modify and restore the global UsingMemkind state, like SetUsingMemkind(newValue),...
static vtkFreeingFunction GetCurrentFreeFunction()
static vtkMallocingFunction GetCurrentMallocFunction()
static vtkReallocingFunction GetCurrentReallocFunction()
Template defining traits of native types used by VTK.
void *(* vtkMallocingFunction)(size_t)
void *(* vtkReallocingFunction)(void *, size_t)
void(* vtkFreeingFunction)(void *)
#define VTK_STANDARD_NEW_BODY(thisClass)