Customizable thread-local and global variables for memory handling. More...
#include <Globals.h>
Public Types | |
| enum | Type { Global = 0 , ThreadLocal = 1 } |
Public Member Functions | |
| Globals (MemoryAllocator &allocator) | |
Static Public Member Functions | |
| static void | init (Type type, GlobalSettings settings={}) |
| Initialized Globals for current thread. | |
| static Globals * | push (Type type, Globals &globals) |
| Sets Globals as current, saving previous one. | |
| static Globals * | pop (Type type) |
| Restores Globals previously replaced by a push. | |
| static Globals & | get (Type type) |
| Obtains current set of Globals. | |
Public Attributes | |
| MemoryAllocator & | allocator |
Customizable thread-local and global variables for memory handling.
This class holds pointers to systems that must be globally available, like the memory allocator. It allows "stacking" different Globals through a push / pop mechanism, connecting them through a linked list. The Default allocator is automatically setup and uses standard malloc, realloc, free for allocations.
Example (Fixed Allocator):
Example (Virtual Allocator):
Example (Memory dump):
| enum SC::Globals::Type |
|
static |
Initialized Globals for current thread.