NVIDIA DeepStream SDK API Reference

6.4 Release
INFER_EXPORT_API::BufferPool< UniPtr > Class Template Reference

Detailed Description

template<class UniPtr>
class INFER_EXPORT_API::BufferPool< UniPtr >

Template class for buffer pool of the specified buffer type.

Template Parameters
UniPtrUnique pointer type of the buffers in the pool.

Definition at line 405 of file infer_utils.h.

Inheritance diagram for INFER_EXPORT_API::BufferPool< UniPtr >:
Collaboration diagram for INFER_EXPORT_API::BufferPool< UniPtr >:

Public Types

using ItemType = typename UniPtr::element_type
 
using RecylePtr = std::unique_ptr< ItemType, std::function< void(ItemType *)> >
 

Public Member Functions

 BufferPool (const std::string &name)
 Constructor. More...
 
virtual ~BufferPool ()
 Destructor. More...
 
bool setBuffer (UniPtr buf)
 Add a buffer to the pool. More...
 
int size ()
 Get the number of free buffers. More...
 
RecylePtr acquireBuffer ()
 Acquire a buffer from the pool. More...
 

Member Typedef Documentation

◆ ItemType

template<class UniPtr >
using INFER_EXPORT_API::BufferPool< UniPtr >::ItemType = typename UniPtr::element_type

Definition at line 407 of file infer_utils.h.

◆ RecylePtr

template<class UniPtr >
using INFER_EXPORT_API::BufferPool< UniPtr >::RecylePtr = std::unique_ptr<ItemType, std::function<void(ItemType*)> >

Definition at line 408 of file infer_utils.h.

Constructor & Destructor Documentation

◆ BufferPool()

template<class UniPtr >
INFER_EXPORT_API::BufferPool< UniPtr >::BufferPool ( const std::string &  name)
inline

Constructor.

Name the pool.

Definition at line 412 of file infer_utils.h.

◆ ~BufferPool()

template<class UniPtr >
virtual INFER_EXPORT_API::BufferPool< UniPtr >::~BufferPool ( )
inlinevirtual

Destructor.

Print debug message of number of free buffers.

Definition at line 417 of file infer_utils.h.

References InferDebug, and INFER_EXPORT_API::safeStr().

Member Function Documentation

◆ acquireBuffer()

template<class UniPtr >
RecylePtr INFER_EXPORT_API::BufferPool< UniPtr >::acquireBuffer ( )
inline

Acquire a buffer from the pool.

This function pops a buffer from the pool queue. A deleter function is associate with the buffer pointer to return the buffer to the pool when it is no longer needed.

Returns
A unique pointer with corresponding deleter function.

Definition at line 450 of file infer_utils.h.

References InferDebug, and INFER_EXPORT_API::safeStr().

◆ setBuffer()

template<class UniPtr >
bool INFER_EXPORT_API::BufferPool< UniPtr >::setBuffer ( UniPtr  buf)
inline

Add a buffer to the pool.

Parameters
[in]bufUnique pointer to a buffer to be added to the pool.
Returns
Boolean error status.

Definition at line 428 of file infer_utils.h.

References InferDebug, and INFER_EXPORT_API::safeStr().

◆ size()

template<class UniPtr >
int INFER_EXPORT_API::BufferPool< UniPtr >::size ( )
inline

Get the number of free buffers.

Definition at line 439 of file infer_utils.h.


The documentation for this class was generated from the following file: