"L. Spiro Engine"
|
Basic allocation methods. More...
#include <LSTLAllocator.h>
Public Member Functions | |
virtual LSVOID *LSE_CALL | Alloc (LSUINTPTR _uiptrSize) |
virtual LSVOID *LSE_CALL | ReAlloc (LSVOID *_pvAddr, LSUINTPTR _uiptrSize) |
virtual LSVOID LSE_CALL | Free (LSVOID *_pvAddr) |
LSVOID LSE_CALL | SetAllocator (CStdAllocator *_psaAllocator) |
CStdAllocator *LSE_CALL | GetAllocator () |
const CStdAllocator *LSE_CALL | GetAllocator () const |
LSVOID LSE_CALL | Trash () |
Protected Attributes | |
CStdAllocator * | m_psaAllocator |
LSUINT32 | m_ui32TotalAllocs |
Static Protected Attributes | |
static LSUINT32 | m_ui32AllocCount |
static LSUINT32 | m_ui32ObjCount |
static CCriticalSection * | m_pcsCrit |
Basic allocation methods.
Class CAllocator Description: Provide a base interface for allocation. All objects in this library use this when they want to allocate RAM. Inherit from this and modify the Alloc, ReAlloc, and Free functions, then pass your class to the templates in this library to make them use your allocation methods instead.
virtual LSVOID* LSE_CALL lstl::CAllocator::Alloc | ( | LSUINTPTR | _uiptrSize | ) | [virtual] |
Allocate.
_uiptrSize | Number of bytes to allocate. |
virtual LSVOID LSE_CALL lstl::CAllocator::Free | ( | LSVOID * | _pvAddr | ) | [virtual] |
CStdAllocator* LSE_CALL lstl::CAllocator::GetAllocator | ( | ) |
Get the allocator used by this object.
const CStdAllocator* LSE_CALL lstl::CAllocator::GetAllocator | ( | ) | const |
Get the allocator used by this object.
virtual LSVOID* LSE_CALL lstl::CAllocator::ReAlloc | ( | LSVOID * | _pvAddr, |
LSUINTPTR | _uiptrSize | ||
) | [virtual] |
Reallocate memory.
_pvAddr | The address whose allocation size is to be changed. If NULL, this behaves exactly the same way as Alloc(). |
_uiptrSize | The new size of the allocated data. |
LSVOID LSE_CALL lstl::CAllocator::SetAllocator | ( | CStdAllocator * | _psaAllocator | ) |
Set the allocator we use.
_psaAllocator | The allocator to be used by this object. |
LSVOID LSE_CALL lstl::CAllocator::Trash | ( | ) |
Trash this allocator. Assumes a special heap has been assigned to this allocator and that heap is about to be trashed.
CCriticalSection* lstl::CAllocator::m_pcsCrit [static, protected] |
Thread safety.
CStdAllocator* lstl::CAllocator::m_psaAllocator [protected] |
The base allocator.
LSUINT32 lstl::CAllocator::m_ui32AllocCount [static, protected] |
Allocation count. Very simple counter that increases with each allocation and decreases with each release. If not 0 at the end of the game's life, something was leaked or over-deallocated.
LSUINT32 lstl::CAllocator::m_ui32ObjCount [static, protected] |
Class counter. Keeps track of the number of this object in existance. When this reaches 0, m_ui32AllocCount is checked for being 0UL. If not, debug information is printed.
LSUINT32 lstl::CAllocator::m_ui32TotalAllocs [protected] |
The number of allocations we have made.