|
| static void * | s_allocate (size_t len, void *, void *this_) |
| static void | s_free (void *mem, size_t len, void *this_) |
Definition at line 6127 of file quickstart.cpp.
◆ ~GlobalAllocatorExample()
| GlobalAllocatorExample::~GlobalAllocatorExample |
( |
| ) |
|
|
inline |
◆ allocate()
| void * GlobalAllocatorExample::allocate |
( |
size_t | len | ) |
|
|
inline |
Definition at line 6133 of file quickstart.cpp.
6134 {
6138
6139 uintptr_t uptr = (uintptr_t)ptr;
6140 const uintptr_t align = alignof(max_align_t);
6141 if (uptr % align)
6142 {
6143 uintptr_t prev = uptr - (uptr % align);
6144 uintptr_t next = prev + align;
6145 uintptr_t corr = next - uptr;
6146 ptr = (void*)(((char*)ptr) + corr);
6148 }
6150 "out of memory! requested=%zu+%zu available=%zu\n",
6152 return ptr;
6153 }
std::vector< char > memory_pool
◆ free()
| void GlobalAllocatorExample::free |
( |
void * | mem, |
|
|
size_t | len ) |
|
inline |
Definition at line 6155 of file quickstart.cpp.
6156 {
6161
6162 }
#define CHECK(predicate)
a quick'n'dirty assertion to verify a predicate
◆ callbacks()
Definition at line 6165 of file quickstart.cpp.
6166 {
6167 ryml::Callbacks cb = {};
6171 }
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 6172 of file quickstart.cpp.
6173 {
6174 return ((GlobalAllocatorExample*)this_)->allocate(len);
6175 }
◆ s_free()
| void GlobalAllocatorExample::s_free |
( |
void * | mem, |
|
|
size_t | len, |
|
|
void * | this_ ) |
|
inlinestatic |
Definition at line 6176 of file quickstart.cpp.
6177 {
6178 ((GlobalAllocatorExample*)this_)->free(mem, len);
6179 }
◆ 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/latest/samples/quickstart.cpp