|
| static void * | s_allocate (size_t len, void *, void *this_) |
| static void | s_free (void *mem, size_t len, void *this_) |
Definition at line 6017 of file quickstart.cpp.
◆ ~GlobalAllocatorExample()
| GlobalAllocatorExample::~GlobalAllocatorExample |
( |
| ) |
|
|
inline |
◆ allocate()
| void * GlobalAllocatorExample::allocate |
( |
size_t | len | ) |
|
|
inline |
Definition at line 6023 of file quickstart.cpp.
6024 {
6028
6029 uintptr_t uptr = (uintptr_t)ptr;
6030 const uintptr_t align = alignof(max_align_t);
6031 if (uptr % align)
6032 {
6033 uintptr_t prev = uptr - (uptr % align);
6034 uintptr_t next = prev + align;
6035 uintptr_t corr = next - uptr;
6036 ptr = (void*)(((char*)ptr) + corr);
6038 }
6040 "out of memory! requested=%zu+%zu available=%zu\n",
6042 return ptr;
6043 }
std::vector< char > memory_pool
◆ free()
| void GlobalAllocatorExample::free |
( |
void * | mem, |
|
|
size_t | len ) |
|
inline |
Definition at line 6045 of file quickstart.cpp.
6046 {
6051
6052 }
#define CHECK(predicate)
a quick'n'dirty assertion to verify a predicate
◆ callbacks()
Definition at line 6055 of file quickstart.cpp.
6056 {
6057 ryml::Callbacks cb = {};
6061 }
static void s_free(void *mem, size_t len, void *this_)
static void * s_allocate(size_t len, void *, void *this_)
Callbacks & set_free(pfn_free free=nullptr)
Set or reset the free callback.
Callbacks & set_allocate(pfn_allocate allocate=nullptr)
Set or reset the allocate callback.
Callbacks & set_user_data(void *user_data)
Set the user data.
◆ s_allocate()
| void * GlobalAllocatorExample::s_allocate |
( |
size_t | len, |
|
|
void * | , |
|
|
void * | this_ ) |
|
inlinestatic |
Definition at line 6062 of file quickstart.cpp.
6063 {
6064 return ((GlobalAllocatorExample*)this_)->allocate(len);
6065 }
◆ s_free()
| void GlobalAllocatorExample::s_free |
( |
void * | mem, |
|
|
size_t | len, |
|
|
void * | this_ ) |
|
inlinestatic |
Definition at line 6066 of file quickstart.cpp.
6067 {
6068 ((GlobalAllocatorExample*)this_)->free(mem, len);
6069 }
◆ check_and_reset()
| void GlobalAllocatorExample::check_and_reset |
( |
| ) |
|
|
inline |
◆ memory_pool
| std::vector<char> GlobalAllocatorExample::memory_pool = std::vector<char>(10u * 1024u) |
◆ num_allocs
| size_t GlobalAllocatorExample::num_allocs = 0 |
◆ alloc_size
| size_t GlobalAllocatorExample::alloc_size = 0 |
◆ corr_size
| size_t GlobalAllocatorExample::corr_size = 0 |
◆ num_deallocs
| size_t GlobalAllocatorExample::num_deallocs = 0 |
◆ dealloc_size
| size_t GlobalAllocatorExample::dealloc_size = 0 |
The documentation for this struct was generated from the following file:
- /home/docs/checkouts/readthedocs.org/user_builds/rapidyaml/checkouts/v0.15.0/samples/quickstart.cpp