NVIDIA Holoscan SDK v2.7.0
Holoscan v2.7.0

Class Buffer

Derived Types

class Buffer

Base class for a buffer containing typed data.

Subclassed by holoscan::inference::DeviceBuffer, holoscan::inference::HostBuffer, holoscan::utils::GxfTensorBuffer

Public Functions

inline explicit Buffer(holoinfer_datatype type = holoinfer_datatype::h_Float32, int device_id = 0)

Construction with default type.

Parameters
  • 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, this is a no-op if the buffer is already large enough.

Parameters

number_of_elements – Number of elements to be resized with

inline holoinfer_datatype get_datatype() const

Get the datatype.

Returns

datatype

inline int get_device() const

Get the device ID.

Returns

device ID

Protected Attributes

holoinfer_datatype type_

Datatype of the elements in the buffer.

int device_id_

Device ID.

Previous Class HoloscanUcxTransmitter
Next Class DataBuffer
© Copyright 2022-2024, NVIDIA. Last updated on Dec 2, 2024.