Kicking it Olde Sküül! Burgerlib on Github Follow Olde Sküül on Twitter Burgerbecky on LinkedIn Burgerbecky on LinkedIn
Loading...
Searching...
No Matches
Public Member Functions | Static Public Attributes | List of all members
Burger::AllocatorANSI Class Reference

ANSI Memory Manager object. More...

Inheritance diagram for Burger::AllocatorANSI:
Inheritance graph
[legend]
Collaboration diagram for Burger::AllocatorANSI:
Collaboration graph
[legend]

Public Member Functions

const Burger::StaticRTTIget_StaticRTTI (void) const noexcept override
 Get the description to the class.
 
 AllocatorANSI () noexcept=default
 Default constructor.
 
void * alloc (uintptr_t uSize) const noexcept final
 Calls malloc().
 
void free (const void *pInput) const noexcept final
 Calls free().
 
void * realloc (const void *pInput, uintptr_t uSize) const noexcept final
 Calls realloc().
 
- Public Member Functions inherited from Burger::AllocatorBase
const Burger::StaticRTTIget_StaticRTTI (void) const noexcept override
 Get the description to the class.
 
 AllocatorBase () noexcept=default
 Default constructor.
 
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::AllocatorBase
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.
 

Detailed Description

ANSI Memory Manager object.


This class allocates and releases memory using the ANSI malloc(), free() and realloc() calls. No support is present to track memory. If memory tracking is desired either use native memory tracking or use AllocatorHandle instead.

Use this object to instruct functions that allocate memory to use malloc/free as the memory allocation system.

Constructor & Destructor Documentation

◆ AllocatorANSI()

Burger::AllocatorANSI::AllocatorANSI ( )
defaultnoexcept

Default constructor.


Member Function Documentation

◆ alloc()

void * Burger::AllocatorANSI::alloc ( uintptr_t uSize) const
finalvirtualnoexcept

Calls malloc().


Calls malloc() and returns the pointer allocated. If the requested memory size is zero or the call fails, a nullptr is returned.

Parameters
uSizeNumber of byte requested to allocate.
Returns
nullptr on failure or zero bytes allocated, or a valid memory pointer.
See also
realloc() or free()

Implements Burger::AllocatorBase.

◆ free()

void Burger::AllocatorANSI::free ( const void * pInput) const
finalvirtualnoexcept

Calls free().


If pInput is nullptr, do nothing. If non-zero, then release the memory back into the free memory pool with a call to free().

Parameters
pInputnullptr to do no operation or a valid pointer to memory allocated by alloc() or realloc().
See also
alloc() or realloc()

Implements Burger::AllocatorBase.

◆ get_StaticRTTI()

const Burger::StaticRTTI * Burger::AllocatorANSI::get_StaticRTTI ( void ) const
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.

Returns
Pointer to a global, read only instance of StaticRTTI for the true class

Reimplemented from Burger::Base.

◆ realloc()

void * Burger::AllocatorANSI::realloc ( const void * pInput,
uintptr_t uSize ) const
finalvirtualnoexcept

Calls realloc().


Calls realloc() and returns the pointer allocated. If the requested memory size is zero or the call fails, a nullptr is returned.

If the function fails, the buffer in pInput is untouched, even though the function returned nullptr. However, if the value in uSize is zero, the buffer is freed in all cases with a call to free().

Note
If the requested size is smaller, it's likely that the buffer is truncated and not changed, however this in not guaranteed behavior. If larger, the buffer may be extended, and it too is not guaranteed to be the same pointer value. Assume the input pointer is invalided from here on out and the return value is the new pointer to the buffer.
Parameters
pInputPointer to a valid buffer to resize.
uSizeNumber of byte requested to allocate.
Returns
nullptr on failure or zero bytes allocated, or a valid memory pointer.
See also
alloc() or free()

Implements Burger::AllocatorBase.

Member Data Documentation

◆ g_StaticRTTI

const Burger::StaticRTTI Burger::AllocatorANSI::g_StaticRTTI
static

The global description of the class.


This record contains the name of this class and a reference to the parent