![]() |
WPILibC++ 2025.3.2
|
A simple pool allocator for Buffers. More...
#include <wpinet/uv/Buffer.h>
Public Member Functions | |
| SimpleBufferPool (size_t size=4096) | |
| Constructor. | |
| ~SimpleBufferPool () | |
| SimpleBufferPool (const SimpleBufferPool &other)=delete | |
| SimpleBufferPool & | operator= (const SimpleBufferPool &other)=delete |
| Buffer | Allocate () |
| Allocate a buffer. | |
| Buffer | operator() () |
| Allocate a buffer. | |
| void | Release (std::span< Buffer > bufs) |
| Release allocated buffers back into the pool. | |
| void | Clear () |
| Clear the pool, releasing all buffers. | |
| size_t | Remaining () const |
| Get number of buffers left in the pool before a new buffer will be allocated from the heap. | |
A simple pool allocator for Buffers.
Buffers are allocated individually but are reused rather than returned to the heap.
| DEPTH | depth of pool |
|
inlineexplicit |
Constructor.
| size | Size of each buffer to allocate. |
|
inline |
|
delete |
|
inline |
Allocate a buffer.
|
inline |
Clear the pool, releasing all buffers.
|
inline |
Allocate a buffer.
|
delete |
|
inline |
Release allocated buffers back into the pool.
This is NOT safe to use with arbitrary buffers unless they were allocated with the same size as the buffer pool allocation size.
|
inline |
Get number of buffers left in the pool before a new buffer will be allocated from the heap.