TachyonUI 0.1.0
High-performance UI for building tools.
Loading...
Searching...
No Matches
gui_allocation_hooks.h
Go to the documentation of this file.
1#pragma once
2
3#include <cstddef>
4
5namespace tachyon
6{
9
15 {
17 void* (*allocate)(size_t size, size_t alignment, void* user) = nullptr;
20 void* (*reallocate)(void* ptr, size_t size, size_t alignment, void* user) = nullptr;
22 void (*free)(void* ptr, void* user) = nullptr;
23 void* user = nullptr;
24
26 bool IsSet() const { return allocate && reallocate && free; }
27 };
28
29}
Definition gui_logging.h:24
Memory functions a host gives the library, for the allocations that can be routed: Vulkan objects,...
Definition gui_allocation_hooks.h:15
void(*) free(void *ptr, void *user)
Frees ptr, which may be null.
Definition gui_allocation_hooks.h:22
void * user
passed to every call
Definition gui_allocation_hooks.h:23
void *(*) allocate(size_t size, size_t alignment, void *user)
Returns size bytes aligned to alignment (a power of two).
Definition gui_allocation_hooks.h:17
void *(*) reallocate(void *ptr, size_t size, size_t alignment, void *user)
Resizes ptr, keeping its alignment; ptr may be null (then it allocates).
Definition gui_allocation_hooks.h:20
bool IsSet() const
The hooks are used only when all three functions are set.
Definition gui_allocation_hooks.h:26