RTC Toolkit 5.1.0
Loading...
Searching...
No Matches
Classes | Public Types | Public Member Functions | List of all members
rtctk::componentFramework::BufferManager Class Reference

BufferManager is a class that will allocate a big buffer and spit it up in several cache-aligned sub-buffers. More...

#include <bufferManager.hpp>

Classes

class  BufferReference
 

Public Types

using Buffer = gsl::span<uint8_t>
 The span definition of a subbuffer.
 

Public Member Functions

 BufferManager ()=delete
 
 BufferManager (const size_t buffer_size, ComponentMetricsIf &metrics, const std::string &description, const std::string &prefix, const size_t buffers, const std::optional< numapp::MemPolicy > &policy={})
 BufferManager constructor.
 
std::shared_ptr< BufferReferenceGet ()
 Get a new buffer from the pool, throws when no buffers are available.
 
std::shared_ptr< BufferReferenceBlockingGet ()
 Same as get, but will not throw but blocks until buffer is free.
 

Detailed Description

BufferManager is a class that will allocate a big buffer and spit it up in several cache-aligned sub-buffers.

The BufferManager can then be used to get references to the subbuffers. These references will then return their subbuffer to the BufferManager when their reference counter reaches zero. This allows to copy data into these subbuffers and then pass it through a pipeline, where it is no longer needed. The subbuffers are created cache-aligned and the BufferManager will try to reuse the most recently returned buffers to optimize cache usage.

Member Typedef Documentation

◆ Buffer

The span definition of a subbuffer.

Constructor & Destructor Documentation

◆ BufferManager() [1/2]

rtctk::componentFramework::BufferManager::BufferManager ( )
delete

◆ BufferManager() [2/2]

rtctk::componentFramework::BufferManager::BufferManager ( const size_t buffer_size,
ComponentMetricsIf & metrics,
const std::string & description,
const std::string & prefix,
const size_t buffers,
const std::optional< numapp::MemPolicy > & policy = {} )

BufferManager constructor.

  • buffer_size size of each buffer
  • metrics Component metrics to be used for reporting the buffer usage
  • description Description used for buffer occupancy metric
  • prefix Prefix to be used for the buffer occupancy metric
  • buffers how many buffers should be allocated, this is the maximum amount available
  • policy Memory policy to use for allocating the buffers

Member Function Documentation

◆ BlockingGet()

std::shared_ptr< BufferManager::BufferReference > rtctk::componentFramework::BufferManager::BlockingGet ( )

Same as get, but will not throw but blocks until buffer is free.

◆ Get()

std::shared_ptr< BufferManager::BufferReference > rtctk::componentFramework::BufferManager::Get ( )

Get a new buffer from the pool, throws when no buffers are available.

Returns
shared pointer to a BufferReference

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