MPD
0.20.18
|
A dynamically allocated buffer which keeps track of its reference count. More...
#include <Page.hxx>
Public Member Functions | |
void | Ref () |
Increases the reference counter. More... | |
bool | Unref () |
Decreases the reference counter. More... | |
Static Public Member Functions | |
static Page * | Copy (const void *data, size_t size) |
Creates a new #page object, and copies data from the specified buffer. More... | |
static Page * | Concat (const Page &a, const Page &b) |
Concatenates two pages to a new page. More... | |
Data Fields | |
const size_t | size |
The size of this buffer in bytes. More... | |
unsigned char | data [sizeof(long)] |
Dynamic array containing the buffer data. More... | |
Protected Member Functions | |
Page (size_t _size) | |
~Page ()=default | |
Static Protected Member Functions | |
static Page * | Create (size_t size) |
Allocates a new Page object, without filling the data element. More... | |
A dynamically allocated buffer which keeps track of its reference count.
This is useful for passing buffers around, when several instances hold references to one buffer.
|
protecteddefault |
Concatenates two pages to a new page.
a | the first page |
b | the second page, which is appended |
|
static |
Creates a new #page object, and copies data from the specified buffer.
It is initialized with a reference count of 1.
data | the source buffer |
size | the size of the source buffer |
|
staticprotected |
Allocates a new Page object, without filling the data element.
bool Page::Unref | ( | ) |
Decreases the reference counter.
If it reaches zero, the #page is freed.
unsigned char Page::data[sizeof(long)] |