rapidyaml  0.10.0
parse and emit YAML, and do it fast
sample::PerTreeMemoryExample Struct Reference

an example for a per-tree memory allocator More...

Public Member Functions

ryml::Callbacks callbacks () const
 
void * allocate (size_t len)
 
void free (void *mem, size_t len)
 
 ~PerTreeMemoryExample ()
 
void check_and_reset ()
 

Public Attributes

std::vector< char > memory_pool = std::vector<char>(10u * 1024u)
 
size_t num_allocs = 0
 
size_t alloc_size = 0
 
size_t num_deallocs = 0
 
size_t dealloc_size = 0
 

Detailed Description

an example for a per-tree memory allocator

Definition at line 5058 of file quickstart.cpp.

Constructor & Destructor Documentation

◆ ~PerTreeMemoryExample()

sample::PerTreeMemoryExample::~PerTreeMemoryExample ( )
inline

Definition at line 5100 of file quickstart.cpp.

5102  {
5103  ryml::EventHandlerTree evt_handler;
The event handler to create a ryml Tree.

Member Function Documentation

◆ callbacks()

ryml::Callbacks sample::PerTreeMemoryExample::callbacks ( ) const
inline

Definition at line 5064 of file quickstart.cpp.

5076 {

◆ allocate()

void* sample::PerTreeMemoryExample::allocate ( size_t  len)
inline

Definition at line 5077 of file quickstart.cpp.

◆ free()

void sample::PerTreeMemoryExample::free ( void *  mem,
size_t  len 
)
inline

Definition at line 5090 of file quickstart.cpp.

5094  {foo: bar})");
5095  mem.check_and_reset();
5096 
5097  // parse another tree and check

◆ check_and_reset()

void sample::PerTreeMemoryExample::check_and_reset ( )
inline

Definition at line 5104 of file quickstart.cpp.

5120  {foo: bar, money: pennys}])", &tree);

Referenced by sample::sample_location_tracking().

Member Data Documentation

◆ memory_pool

std::vector<char> sample::PerTreeMemoryExample::memory_pool = std::vector<char>(10u * 1024u)

Definition at line 5060 of file quickstart.cpp.

◆ num_allocs

size_t sample::PerTreeMemoryExample::num_allocs = 0

Definition at line 5061 of file quickstart.cpp.

◆ alloc_size

size_t sample::PerTreeMemoryExample::alloc_size = 0

Definition at line 5061 of file quickstart.cpp.

◆ num_deallocs

size_t sample::PerTreeMemoryExample::num_deallocs = 0

Definition at line 5062 of file quickstart.cpp.

◆ dealloc_size

size_t sample::PerTreeMemoryExample::dealloc_size = 0

Definition at line 5062 of file quickstart.cpp.


The documentation for this struct was generated from the following file: