|
|
|
|
Documentation |
|
Main Page Namespace List Class Hierarchy Alphabetical List Compound List File List Namespace Members Compound Members File Members Related Pages Search
NLMISC::CHeapMemory Class ReferenceA Heap manager.
More...
#include <heap_memory.h>
List of all members.
Detailed Description
A Heap manager.
Work with any kind of memory. This heap manager is not designed for speed (because it stills use standard heap allocation), but for use with special memory or special cases where malloc/new cannot be used. -
Author:
-
Lionel Berenguier , Nevrax France
-
Date:
-
2001
Definition at line 46 of file heap_memory.h.
Member Typedef Documentation
typedef TAllocatedSpaceMap::iterator NLMISC::CHeapMemory::ItAllocatedSpaceMap [private]
|
|
typedef TEmptySpacePtrMap::iterator NLMISC::CHeapMemory::ItEmptySpacePtrMap [private]
|
|
typedef TEmptySpaceSizeMap::iterator NLMISC::CHeapMemory::ItEmptySpaceSizeMap [private]
|
|
typedef std::map<uint8*, uint> NLMISC::CHeapMemory::TAllocatedSpaceMap [private]
|
|
typedef std::map<uint8*, CEmptySpace> NLMISC::CHeapMemory::TEmptySpacePtrMap [private]
|
|
typedef std::multimap<uint, uint8*> NLMISC::CHeapMemory::TEmptySpaceSizeMap [private]
|
|
Constructor & Destructor Documentation
NLMISC::CHeapMemory::CHeapMemory |
( |
|
) |
|
|
NLMISC::CHeapMemory::~CHeapMemory |
( |
|
) |
|
|
Member Function Documentation
void NLMISC::CHeapMemory::addEmptySpace |
( |
CEmptySpace & |
space |
) |
[private] |
|
void * NLMISC::CHeapMemory::allocate |
( |
uint |
size |
) |
|
|
|
allocate a block of size bytes.
return NULL if not enough space or if size==0. NB: for alignements consideration, allocation are aligned to 4 bytes.
Definition at line 118 of file heap_memory.cpp.
References _Alignment, _AllocatedSpaceMap, _EmptySpaceMap, _EmptySpaces, _HeapSizeUsed, addEmptySpace, ItEmptySpaceSizeMap, and removeEmptySpace.
Referenced by NL3D::CVertexBufferHeap::allocate, NL3D::CVertexArrayRangeATI::allocateVB, and NL3D::CVertexArrayRangeNVidia::allocateVB. |
void NLMISC::CHeapMemory::free |
( |
void * |
ptr |
) |
|
|
|
free a block allocated with alloate(). no-op if NULL. nlstop() if don't find this block.
Definition at line 173 of file heap_memory.cpp.
References _AllocatedSpaceMap, _EmptySpaces, _HeapSizeUsed, addEmptySpace, ItAllocatedSpaceMap, ItEmptySpacePtrMap, nlassert, nlstop, and removeEmptySpace.
Referenced by NL3D::CVertexBufferHeap::free, NL3D::CVertexArrayRangeATI::freeVB, and NL3D::CVertexArrayRangeNVidia::freeVB. |
uint NLMISC::CHeapMemory::getHeapSize |
( |
|
) |
const [inline] |
|
uint NLMISC::CHeapMemory::getHeapSizeUsed |
( |
|
) |
const [inline] |
|
void NLMISC::CHeapMemory::initHeap |
( |
void * |
heap, |
|
|
uint |
size, |
|
|
uint |
align = 4 |
|
) |
|
|
|
init the heap.
this reset() the heap. heap ptr is stored in this class, but no CHeapMemory methods write or read into. They use standard heap instead (new / delete). -
Parameters:
-
heap |
the heap ptr. heap should be at least N-bytes aligned, where N is the alignment you need (see param align, 4 by default). |
align |
Any size given to allocate() will be rounded to match this alignement. Valid values are 4,8,16, or 32. 4 by default. |
Definition at line 64 of file heap_memory.cpp.
References _Alignment, _HeapPtr, _HeapSize, _HeapSizeUsed, addEmptySpace, nlstop, and reset.
Referenced by NL3D::CVertexArrayRangeATI::allocate, NL3D::CVertexArrayRangeNVidia::allocate, and NL3D::CVertexBufferHeap::init. |
void NLMISC::CHeapMemory::removeEmptySpace |
( |
CEmptySpace & |
space |
) |
[private] |
|
void NLMISC::CHeapMemory::reset |
( |
|
) |
|
|
Member Data Documentation
uint NLMISC::CHeapMemory::_Alignment [private]
|
|
uint8* NLMISC::CHeapMemory::_HeapPtr [private]
|
|
uint NLMISC::CHeapMemory::_HeapSize [private]
|
|
uint NLMISC::CHeapMemory::_HeapSizeUsed [private]
|
|
The documentation for this class was generated from the following files:
|
|