The GenericBuffer class is a templated class for buffers. More...
#include <buffers.hpp>
Public Member Functions | |
GenericBuffer (nvinfer1::DataType type=nvinfer1::DataType::kFLOAT) | |
Construct an empty buffer. | |
GenericBuffer (size_t size, nvinfer1::DataType type) | |
Construct a buffer with the specified allocation size in bytes. | |
GenericBuffer (GenericBuffer &&buf) | |
GenericBuffer & | operator= (GenericBuffer &&buf) |
void * | data () |
Returns pointer to underlying array. | |
const void * | data () const |
Returns pointer to underlying array. | |
size_t | size () const |
Returns the size (in number of elements) of the buffer. | |
size_t | nbBytes () const |
Returns the size (in bytes) of the buffer. | |
void | resize (size_t newSize) |
Resizes the buffer. This is a no-op if the new size is smaller than or equal to the current capacity. | |
void | resize (const nvinfer1::Dims &dims) |
Overload of resize that accepts Dims. | |
~GenericBuffer () | |
Private Attributes | |
size_t | mSize {0} |
size_t | mCapacity {0} |
nvinfer1::DataType | mType |
void * | mBuffer |
AllocFunc | allocFn |
FreeFunc | freeFn |
The GenericBuffer class is a templated class for buffers.
This templated RAII (Resource Acquisition Is Initialization) class handles the allocation, deallocation, querying of buffers on both the device and the host. It can handle data of arbitrary types because it stores byte buffers. The template parameters AllocFunc and FreeFunc are used for the allocation and deallocation of the buffer. AllocFunc must be a functor that takes in (void** ptr, size_t size) and returns bool. ptr is a pointer to where the allocated buffer address should be stored. size is the amount of memory in bytes to allocate. The boolean indicates whether or not the memory allocation was successful. FreeFunc must be a functor that takes in (void* ptr) and returns void. ptr is the allocated buffer address. It must work with nullptr input.
Definition at line 103 of file buffers.hpp.
|
inline |
Construct an empty buffer.
Definition at line 109 of file buffers.hpp.
|
inline |
Construct a buffer with the specified allocation size in bytes.
Definition at line 120 of file buffers.hpp.
|
inline |
Definition at line 131 of file buffers.hpp.
|
inline |
Definition at line 217 of file buffers.hpp.
|
inline |
Returns pointer to underlying array.
Definition at line 163 of file buffers.hpp.
Referenced by adcCtrl.AdcFitter::clear(), utils.AdcFitter::clear(), camtipSR.utils.camtipFitter::clear(), adcCtrl.AdcFitter::cost(), utils.AdcFitter::cost(), adcCtrl.AdcFitter::estimate_angle(), utils.AdcFitter::estimate_angle(), adcCtrl.AdcFitter::estimate_centroid(), utils.AdcFitter::estimate_centroid(), adcCtrl.AdcFitter::find_speckle_angles2(), utils.AdcFitter::find_speckle_angles2(), and camtipSR.utils.camtipFitter::set_data().
|
inline |
Returns pointer to underlying array.
Definition at line 171 of file buffers.hpp.
Referenced by adcCtrl.AdcFitter::clear(), utils.AdcFitter::clear(), camtipSR.utils.camtipFitter::clear(), adcCtrl.AdcFitter::cost(), utils.AdcFitter::cost(), adcCtrl.AdcFitter::estimate_angle(), utils.AdcFitter::estimate_angle(), adcCtrl.AdcFitter::estimate_centroid(), utils.AdcFitter::estimate_centroid(), adcCtrl.AdcFitter::find_speckle_angles2(), utils.AdcFitter::find_speckle_angles2(), and camtipSR.utils.camtipFitter::set_data().
|
inline |
Returns the size (in bytes) of the buffer.
Definition at line 187 of file buffers.hpp.
Referenced by GenericBuffer< AllocFunc, FreeFunc >::GenericBuffer(), and GenericBuffer< AllocFunc, FreeFunc >::resize().
|
inline |
Definition at line 143 of file buffers.hpp.
|
inline |
Overload of resize that accepts Dims.
Definition at line 212 of file buffers.hpp.
|
inline |
Resizes the buffer. This is a no-op if the new size is smaller than or equal to the current capacity.
Definition at line 195 of file buffers.hpp.
Referenced by GenericBuffer< AllocFunc, FreeFunc >::resize().
|
inline |
Returns the size (in number of elements) of the buffer.
Definition at line 179 of file buffers.hpp.
Referenced by GenericBuffer< AllocFunc, FreeFunc >::nbBytes().
|
private |
Definition at line 226 of file buffers.hpp.
Referenced by GenericBuffer< AllocFunc, FreeFunc >::GenericBuffer(), and GenericBuffer< AllocFunc, FreeFunc >::resize().
|
private |
Definition at line 227 of file buffers.hpp.
Referenced by GenericBuffer< AllocFunc, FreeFunc >::~GenericBuffer(), GenericBuffer< AllocFunc, FreeFunc >::operator=(), and GenericBuffer< AllocFunc, FreeFunc >::resize().
|
private |
Definition at line 225 of file buffers.hpp.
Referenced by GenericBuffer< AllocFunc, FreeFunc >::GenericBuffer(), GenericBuffer< AllocFunc, FreeFunc >::~GenericBuffer(), GenericBuffer< AllocFunc, FreeFunc >::data(), GenericBuffer< AllocFunc, FreeFunc >::data(), GenericBuffer< AllocFunc, FreeFunc >::operator=(), and GenericBuffer< AllocFunc, FreeFunc >::resize().
|
private |
Definition at line 223 of file buffers.hpp.
Referenced by GenericBuffer< AllocFunc, FreeFunc >::operator=(), and GenericBuffer< AllocFunc, FreeFunc >::resize().
|
private |
Definition at line 223 of file buffers.hpp.
Referenced by GenericBuffer< AllocFunc, FreeFunc >::operator=(), GenericBuffer< AllocFunc, FreeFunc >::resize(), and GenericBuffer< AllocFunc, FreeFunc >::size().
|
private |
Definition at line 224 of file buffers.hpp.
Referenced by GenericBuffer< AllocFunc, FreeFunc >::nbBytes(), and GenericBuffer< AllocFunc, FreeFunc >::operator=().