|
Click
|
Class used to provide a pool of buffers that can have a dynamic size and be resized at any moment. More...
#include <bufferpool.hh>
Public Member Functions | |
| BufferPool (uint32_t initialNumber, uint32_t initialSize) | |
| Construct a BufferPool. | |
| ~BufferPool () | |
| Destruct a BufferPool and free the memory. | |
| BufferPoolNode * | getBuffer () |
| Return a buffer from the pool. Note that the size of the buffer is random, so be sure to resize it to fit your needs. | |
| void | releaseBuffer (BufferPoolNode *buffer) |
| Put back a buffer into the pool. | |
Class used to provide a pool of buffers that can have a dynamic size and be resized at any moment.
Contrarily to MemoryPool, BufferPool provides a pool of buffers that can have a dynamic size and be resized at any moment. The drawback is that the BufferPool does not directly return a chunk of memory (as MemoryPool does) but a pointer to a BufferPoolNode that contains the memory chunk. The pointer to the BufferPoolNode must also be used to release memory.
| BufferPool::BufferPool | ( | uint32_t | initialNumber, |
| uint32_t | initialSize | ||
| ) |
Construct a BufferPool.
| initialNumber | The initial number of buffers in the pool |
| initialSize | The initial size of the buffers in the pool |
| BufferPool::~BufferPool | ( | ) |
Destruct a BufferPool and free the memory.
| BufferPoolNode * BufferPool::getBuffer | ( | ) |
Return a buffer from the pool. Note that the size of the buffer is random, so be sure to resize it to fit your needs.
| void BufferPool::releaseBuffer | ( | BufferPoolNode * | buffer | ) |
Put back a buffer into the pool.
| buffer | A pointer to the BufferPoolNode used to manage the buffer |