Kicking it Olde Sküül! Burgerlib on Github Follow Olde Sküül on Twitter Burgerbecky on LinkedIn Burgerbecky on LinkedIn
Loading...
Searching...
No Matches
Burger::MemoryManagerGlobalANSI Class Reference

Global ANSI Memory Manager helper class. More...

Inheritance diagram for Burger::MemoryManagerGlobalANSI:
Collaboration diagram for Burger::MemoryManagerGlobalANSI:

Public Member Functions

 MemoryManagerGlobalANSI () noexcept
 Attaches a MemoryManagerANSI class to the global memory manager.
 
 ~MemoryManagerGlobalANSI ()
 Releases a MemoryManagerANSI class from the global memory manager.
 
- Public Member Functions inherited from Burger::MemoryManagerANSI
 MemoryManagerANSI () noexcept
 Constructor for the ANSI memory allocator.
 
void * allocate_memory (uintptr_t uSize) noexcept
 Allocates memory.
 
void free_memory (const void *pInput) noexcept
 Frees memory.
 
void * reallocate_memory (const void *pInput, uintptr_t uSize) noexcept
 Reallocates memory.
 
- Public Member Functions inherited from Burger::MemoryManager
void * allocate_memory (uintptr_t uSize) noexcept
 Allocate memory.
 
void free_memory (const void *pInput) noexcept
 Release memory.
 
void * reallocate_memory (const void *pInput, uintptr_t uSize) noexcept
 Reallocate memory.
 
void shutdown (void) noexcept
 Shut down the memory manager.
 
void * allocate_memory_clear (uintptr_t uSize) noexcept
 Allocate a block of pre-zeroed memory.
 

Protected Attributes

MemoryManagerm_pPrevious
 Pointer to the previous memory manager.
 

Private Member Functions

 MemoryManagerGlobalANSI (const MemoryManagerGlobalANSI &)=delete
 
MemoryManagerGlobalANSIoperator= (const MemoryManagerGlobalANSI &)=delete
 
 MemoryManagerGlobalANSI (MemoryManagerGlobalANSI &&)=delete
 
MemoryManagerGlobalANSIoperator= (MemoryManagerGlobalANSI &&)=delete
 

Additional Inherited Members

- Public Types inherited from Burger::MemoryManager
typedef void *(* allocate_proc_t) (MemoryManager *pThis, uintptr_t uSize)
 Function prototype for allocating memory.
 
typedef void(* free_proc_t) (MemoryManager *pThis, const void *pInput)
 Function prototype for releasing memory.
 
typedef void *(* reallocate_proc_t) (MemoryManager *pThis, const void *pInput, uintptr_t uSize)
 Function prototype for reallocating memory.
 
typedef void(* shutdown_callback_t) (MemoryManager *pThis)
 Function prototype for destructor.
 
- Static Public Member Functions inherited from Burger::MemoryManager
static void shutdown (MemoryManager *pThis) noexcept
 Default memory manager destructor.
 
- Public Attributes inherited from Burger::MemoryManager
allocate_proc_t m_pAllocate
 Pointer to allocation function.
 
free_proc_t m_pFree
 Pointer to memory release function.
 
reallocate_proc_t m_pReallocate
 Pointer to the memory reallocation function.
 
shutdown_callback_t m_pShutdown
 Pointer to the shutdown function.
 
- Static Protected Member Functions inherited from Burger::MemoryManagerANSI
static void * allocate_memory (MemoryManager *pThis, uintptr_t uSize) noexcept
 Calls malloc().
 
static void free_memory (MemoryManager *pThis, const void *pInput) noexcept
 Calls free().
 
static void * reallocate_memory (MemoryManager *pThis, const void *pInput, uintptr_t uSize) noexcept
 Calls realloc().
 

Detailed Description

Global ANSI Memory Manager helper class.


This class is a helper that attaches a MemoryManagerANSI class to the global memory manager. When this instance shuts down, it will remove itself from the global memory manager and set the global memory manager to the previous one.

Note
This class cannot be copied or moved.
See also
GlobalMemoryManager, or MemoryManagerANSI

Constructor & Destructor Documentation

◆ MemoryManagerGlobalANSI() [1/3]

Burger::MemoryManagerGlobalANSI::MemoryManagerGlobalANSI ( const MemoryManagerGlobalANSI & )
privatedelete

◆ MemoryManagerGlobalANSI() [2/3]

Burger::MemoryManagerGlobalANSI::MemoryManagerGlobalANSI ( MemoryManagerGlobalANSI && )
privatedelete

◆ MemoryManagerGlobalANSI() [3/3]

Burger::MemoryManagerGlobalANSI::MemoryManagerGlobalANSI ( )
noexcept

Attaches a MemoryManagerANSI class to the global memory manager.


When this class is created, it will automatically attach itself to the global memory manager and save the pointer to the previous instantiation so when this class goes out of scope, the previous memory manager is reinstated

Example...

void DoSomething()
{
// Tell Burgerlib to use ANSI memory chunks
CallFunctionThatUsesMemory();
CallFunctionThatCleansUpMemory();
// When going out of scope, HandleBasedMemory is restored
}
int main(int, char**)
{
// Use handle based memory
MemoryManagerGlobalHandle HandleBasedMemory;
// Function uses it's own memory manager
DoSomething();
// HandleBasedMemory is active again
return 0;
}
MemoryManagerGlobalANSI(const MemoryManagerGlobalANSI &)=delete
Global Handle Memory Manager helper class.
Definition burger.h:10684

◆ ~MemoryManagerGlobalANSI()

Burger::MemoryManagerGlobalANSI::~MemoryManagerGlobalANSI ( )

Releases a MemoryManagerANSI class from the global memory manager.


When this class is released, it will automatically remove itself to the global memory manager and restore the previous memory manager to the global memory manager.

See also
MemoryManagerGlobalANSI(), or GlobalMemoryManager

Member Function Documentation

◆ operator=() [1/2]

MemoryManagerGlobalANSI & Burger::MemoryManagerGlobalANSI::operator= ( const MemoryManagerGlobalANSI & )
privatedelete

◆ operator=() [2/2]

MemoryManagerGlobalANSI & Burger::MemoryManagerGlobalANSI::operator= ( MemoryManagerGlobalANSI && )
privatedelete

Member Data Documentation

◆ m_pPrevious

MemoryManager* Burger::MemoryManagerGlobalANSI::m_pPrevious
protected

Pointer to the previous memory manager.