holoscan::utils::cuda::Buffer

Beta
View as Markdown

Base class for a buffer containing typed data.

#include <holoscan/utils/cuda/buffer.hpp>

Constructors

Buffer

holoscan::utils::cuda::Buffer::Buffer(holoscan::utils::cuda::Buffer::Buffer(
BufferDataType data_type = BufferDataType::Float32, BufferDataType data_type = BufferDataType::Float32,
int device_id = 0
)

Constructor with default type.

Parameters

data_type
BufferDataTypeDefaults to BufferDataType::Float32

Data type, defaults to Float32

device_id
intDefaults to 0

GPU device ID, defaults to 0

Destructor

~Buffer

virtual holoscan::utils::cuda::Buffer::~Buffer() = defaultvirtual holoscan::utils::cuda::Buffer::~Buffer() = default

Methods

data

virtual void * holoscan::utils::cuda::Buffer::data()

Get the data buffer.

Returns: Void pointer to the buffer

size

virtual size_t holoscan::utils::cuda::Buffer::size() const

Get the size of the allocated buffer in elements.

Returns: size in elements

get_bytes

virtual size_t holoscan::utils::cuda::Buffer::get_bytes() const

Get the bytes allocated.

Returns: allocated bytes

resize

virtual void holoscan::utils::cuda::Buffer::resize(
size_t number_of_elements
)

Resize the underlying buffer.

Parameters

number_of_elements
size_t

Number of elements to be resized with

get_datatype

BufferDataType holoscan::utils::cuda::Buffer::get_datatype() constBufferDataType holoscan::utils::cuda::Buffer::get_datatype() const

Get the datatype.

Returns: datatype

get_device

int holoscan::utils::cuda::Buffer::get_device() const

Get the device ID.

Returns: device ID


Member variables

NameTypeDescription
data_type_BufferDataTypeDatatype of the elements in the buffer.
device_id_intDevice ID.