NVIDIA Holoscan SDK v3.8.0

Class Buffer

Derived Types

class Buffer

Base class for a buffer containing typed data.

Subclassed by holoscan::utils::cuda::CudaHostMappedBuffer, holoscan::utils::cuda::DeviceBuffer

Public Functions

inline explicit Buffer(BufferDataType data_type = BufferDataType::Float32, int device_id = 0)

Constructor with default type.

Parameters
  • data_type – Data type, defaults to Float32

  • device_id – GPU device ID, defaults to 0

virtual ~Buffer() = default
virtual void *data() = 0

Get the data buffer.

Returns

Void pointer to the buffer

virtual size_t size() const = 0

Get the size of the allocated buffer in elements.

Returns

size in elements

virtual size_t get_bytes() const = 0

Get the bytes allocated.

Returns

allocated bytes

virtual void resize(size_t number_of_elements) = 0

Resize the underlying buffer.

Parameters

number_of_elements – Number of elements to be resized with

inline BufferDataType get_datatype() const

Get the datatype.

Returns

datatype

inline int get_device() const

Get the device ID.

Returns

device ID

Protected Attributes

BufferDataType data_type_

Datatype of the elements in the buffer.

int device_id_

Device ID.

Previous Class UnboundedAllocator
Next Class CudaAllocator
© Copyright 2022-2025, NVIDIA. Last updated on Nov 6, 2025