A manager of fixed size buffers in multi-thread environment. More...
#include <yarp/dev/impl/FixedSizeBuffersManager.h>
A manager of fixed size buffers in multi-thread environment.
When it is created it allocates initialNumOfBuffers
buffers of size sizeOfBuffers
. The user can get a buffer, uses and releases it when he/she doesn't need anymore. If all buffers are busy and a new buffer is required, than the manager creates new one.
Definition at line 87 of file FixedSizeBuffersManager.h.
Public Member Functions | |
FixedSizeBuffersManager (uint32_t sizeOfBuffers, std::size_t initialNumOfBuffers=3) | |
Constructor. More... | |
~FixedSizeBuffersManager () | |
Destructor. More... | |
Buffer< T > | getBuffer () |
Get a buffer and fill its information in @buffer. More... | |
std::size_t | getBufferSize () |
Get the number of elements of a buffer. More... | |
void | releaseBuffer (Buffer< T > &buffer) |
Release a buffer. More... | |
void | printBuffers () |
Prints info of buffers. More... | |
|
explicit |
Constructor.
Allocate initialNumOfBuffers
buffers of size sizeOfBuffers.
Definition at line 72 of file FixedSizeBuffersManager-inl.h.
yarp::dev::impl::FixedSizeBuffersManager< T >::~FixedSizeBuffersManager |
Destructor.
Delete all allocated buffers.
Definition at line 184 of file FixedSizeBuffersManager-inl.h.
yarp::dev::impl::Buffer< T > yarp::dev::impl::FixedSizeBuffersManager< T >::getBuffer |
Get a buffer and fill its information in @buffer.
Definition at line 87 of file FixedSizeBuffersManager-inl.h.
std::size_t yarp::dev::impl::FixedSizeBuffersManager< T >::getBufferSize |
Get the number of elements of a buffer.
Definition at line 193 of file FixedSizeBuffersManager-inl.h.
void yarp::dev::impl::FixedSizeBuffersManager< T >::printBuffers |
Prints info of buffers.
Function for debug purpose
Definition at line 172 of file FixedSizeBuffersManager-inl.h.
void yarp::dev::impl::FixedSizeBuffersManager< T >::releaseBuffer | ( | Buffer< T > & | buffer | ) |
Release a buffer.
This function should be used by user when he/she doesn't need it anymore. It releases a buffer in constant time.
[in] | buffer |
Definition at line 156 of file FixedSizeBuffersManager-inl.h.