Class Buffer
Defined in File holoinfer_buffer.hpp
Derived Types
public holoscan::inference::DeviceBuffer
(Class DeviceBuffer)public holoscan::inference::HostBuffer
(Class HostBuffer)public holoscan::utils::GxfTensorBuffer
(Class GxfTensorBuffer)
-
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.
-
inline explicit Buffer(holoinfer_datatype type = holoinfer_datatype::h_Float32, int device_id = 0)