|
| static void * | s_allocate (size_t len, void *, void *this_) |
| static void | s_free (void *mem, size_t len, void *this_) |
Definition at line 6124 of file quickstart.cpp.
◆ ~GlobalAllocatorExample()
| GlobalAllocatorExample::~GlobalAllocatorExample |
( |
| ) |
|
|
inline |
◆ allocate()
| void * GlobalAllocatorExample::allocate |
( |
size_t | len | ) |
|
|
inline |
Definition at line 6130 of file quickstart.cpp.
6131 {
6135
6136 uintptr_t uptr = (uintptr_t)ptr;
6137 const uintptr_t align = alignof(max_align_t);
6138 if (uptr % align)
6139 {
6140 uintptr_t prev = uptr - (uptr % align);
6141 uintptr_t next = prev + align;
6142 uintptr_t corr = next - uptr;
6143 ptr = (void*)(((char*)ptr) + corr);
6145 }
6147 "out of memory! requested=%zu+%zu available=%zu\n",
6149 return ptr;
6150 }
std::vector< char > memory_pool
◆ free()
| void GlobalAllocatorExample::free |
( |
void * | mem, |
|
|
size_t | len ) |
|
inline |
Definition at line 6152 of file quickstart.cpp.
6153 {
6158
6159 }
#define CHECK(predicate)
a quick'n'dirty assertion to verify a predicate
◆ callbacks()
Definition at line 6162 of file quickstart.cpp.
6163 {
6164 ryml::Callbacks cb = {};
6168 }
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 6169 of file quickstart.cpp.
6170 {
6171 return ((GlobalAllocatorExample*)this_)->allocate(len);
6172 }
◆ s_free()
| void GlobalAllocatorExample::s_free |
( |
void * | mem, |
|
|
size_t | len, |
|
|
void * | this_ ) |
|
inlinestatic |
Definition at line 6173 of file quickstart.cpp.
6174 {
6175 ((GlobalAllocatorExample*)this_)->free(mem, len);
6176 }
◆ 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.1/samples/quickstart.cpp