Base class for memory manager objects. More...
Public Member Functions | |
const Burger::StaticRTTI * | get_StaticRTTI (void) const noexcept override |
Get the description to the class. | |
AllocatorBase () noexcept=default | |
Default constructor. | |
virtual void * | alloc (uintptr_t uSize) const noexcept=0 |
Allocate memory. | |
virtual void | free (const void *pInput) const noexcept=0 |
Release memory. | |
virtual void * | realloc (const void *pInput, uintptr_t uSize) const noexcept=0 |
Reallocate memory. | |
void * | alloc_clear (uintptr_t uSize) const noexcept |
Allocate memory that is preinitialized to zero. | |
void * | alloc_copy (const void *pInput, uintptr_t uSize) const noexcept |
Allocate a buffer and copy data into it. | |
Public Member Functions inherited from Burger::Base | |
const char * | get_class_name (void) const noexcept |
Get the name of the class. | |
virtual | ~Base () noexcept=default |
Destructor. | |
Static Public Attributes | |
static const Burger::StaticRTTI | g_StaticRTTI |
The global description of the class. | |
Static Public Attributes inherited from Burger::Base | |
static const Burger::StaticRTTI | g_StaticRTTI |
The global description of the class. | |
Base class for memory manager objects.
To allow functions that allocate memory to use arbitrary memory allocation systems, this class instance is passed so functionality could be redirected to any memory allocated needed.
Since this is defined as a base class, it's not meant to be created directly. Derive from this class to implement a custom memory handler, or use the predefined AllocatorANSI or AllocatorHandle classes.
|
defaultnoexcept |
Default constructor.
|
pure virtualnoexcept |
Allocate memory.
Allocate memory. If the function fails, return nullptr
uSize | Number of bytes to allocate |
Implemented in Burger::AllocatorANSI, and Burger::AllocatorHandle.
|
noexcept |
|
noexcept |
Allocate a buffer and copy data into it.
Allocate memory and copy the contents of the pointer to the new memory
pInput | Pointer to the data to copy. nullptr will leave the data uninitialized |
uSize | Size of the buffer to allocate. |
|
pure virtualnoexcept |
Release memory.
If nullptr is passed, do nothing. Otherwise, release the memory.
pInput | Pointer to memory to release, or nullptr. |
Implemented in Burger::AllocatorANSI, and Burger::AllocatorHandle.
|
overridevirtualnoexcept |
Get the description to the class.
This virtual function will pull the pointer to the StaticRTTI instance that has the name of the class. Due to it being virtual, it will be the name of the most derived class.
Reimplemented from Burger::Base.
Reimplemented in Burger::AllocatorHandle.
|
pure virtualnoexcept |
Reallocate memory.
Call the virtual function to reallocate memory. If the function fails, the memory in pInput is left intact and nullptr is returned. If uSize is zero, pInput is freed and nullptr is returned.
pInput | Pointer to memory to read from and release |
uSize | Number of bytes to allocate |
Implemented in Burger::AllocatorANSI, and Burger::AllocatorHandle.
|
static |
The global description of the class.
This record contains the name of this class and a reference to the parent