|
| static void * | s_allocate (size_t len, void *, void *this_) |
| static void | s_free (void *mem, size_t len, void *this_) |
Definition at line 5823 of file quickstart.cpp.
◆ ~GlobalAllocatorExample()
| GlobalAllocatorExample::~GlobalAllocatorExample |
( |
| ) |
|
|
inline |
◆ allocate()
| void * GlobalAllocatorExample::allocate |
( |
size_t | len | ) |
|
|
inline |
Definition at line 5829 of file quickstart.cpp.
5830 {
5834
5835 uintptr_t uptr = (uintptr_t)ptr;
5836 const uintptr_t align = alignof(max_align_t);
5837 if (uptr % align)
5838 {
5839 uintptr_t prev = uptr - (uptr % align);
5840 uintptr_t next = prev + align;
5841 uintptr_t corr = next - uptr;
5842 ptr = (void*)(((char*)ptr) + corr);
5844 }
5846 "out of memory! requested=%zu+%zu available=%zu\n",
5848 return ptr;
5849 }
std::vector< char > memory_pool
◆ free()
| void GlobalAllocatorExample::free |
( |
void * | mem, |
|
|
size_t | len ) |
|
inline |
Definition at line 5851 of file quickstart.cpp.
5852 {
5857
5858 }
#define CHECK(predicate)
a quick'n'dirty assertion to verify a predicate
◆ callbacks()
Definition at line 5861 of file quickstart.cpp.
5862 {
5863 ryml::Callbacks cb = {};
5867 }
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 5868 of file quickstart.cpp.
5869 {
5870 return ((GlobalAllocatorExample*)this_)->allocate(len);
5871 }
◆ s_free()
| void GlobalAllocatorExample::s_free |
( |
void * | mem, |
|
|
size_t | len, |
|
|
void * | this_ ) |
|
inlinestatic |
Definition at line 5872 of file quickstart.cpp.
5873 {
5874 ((GlobalAllocatorExample*)this_)->free(mem, len);
5875 }
◆ 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.14.0/samples/quickstart.cpp