MPD
0.20.15
|
An allocator for MusicChunk objects. More...
#include <MusicBuffer.hxx>
Public Member Functions | |
MusicBuffer (unsigned num_chunks) noexcept | |
Creates a new MusicBuffer object. More... | |
bool | IsEmptyUnsafe () const |
Check whether the buffer is empty. More... | |
gcc_pure unsigned | GetSize () const noexcept |
Returns the total number of reserved chunks in this buffer. More... | |
MusicChunk * | Allocate () noexcept |
Allocates a chunk from the buffer. More... | |
void | Return (MusicChunk *chunk) noexcept |
Returns a chunk to the buffer. More... | |
An allocator for MusicChunk objects.
Definition at line 31 of file MusicBuffer.hxx.
|
noexcept |
Creates a new MusicBuffer object.
num_chunks | the number of MusicChunk reserved in this buffer |
|
noexcept |
Allocates a chunk from the buffer.
When it is not used anymore, call Return().
|
inlinenoexcept |
Returns the total number of reserved chunks in this buffer.
This is the same value which was passed to the constructor music_buffer_new().
Definition at line 63 of file MusicBuffer.hxx.
|
inline |
Check whether the buffer is empty.
This call is not protected with the mutex, and may only be used while this object is inaccessible to other threads.
Definition at line 52 of file MusicBuffer.hxx.
|
noexcept |
Returns a chunk to the buffer.
It can be reused by Allocate() then.