Detailed Description
Bank module Bank are used to allocate a portion of memory. Applications can get cell from this memory and use it. If the number of allocations requests become bigger than the bank size, a new segment of memory is automatically allocated. Memory bank can be used to try to reduce memory fragmentation.
Define Documentation
| #define orxBANK_KU32_FLAG_NONE 0x00000000 |
No flags (default behaviour)
Definition at line 59 of file orxBank.h.
| #define orxBANK_KU32_FLAG_NOT_EXPANDABLE 0x00000001 |
The bank will not be expandable
Definition at line 60 of file orxBank.h.
Typedef Documentation
Function Documentation
| orxDLLAPI void* orxFASTCALL orxBank_Allocate |
( |
orxBANK * |
_pstBank ) |
|
Allocates a new cell from the bank
- Parameters:
-
| [in] | _pstBank | Pointer on the memory bank to use |
- Returns:
- a new cell of memory (orxNULL if no allocation possible)
| orxDLLAPI void orxFASTCALL orxBank_Clear |
( |
orxBANK * |
_pstBank ) |
|
Frees all allocated cell from a bank
- Parameters:
-
| [in] | _pstBank | Bank of memory to clear |
| orxDLLAPI void orxFASTCALL orxBank_Compact |
( |
orxBANK * |
_pstBank ) |
|
Compacts a bank by removing all its unused segments
- Parameters:
-
| [in] | _pstBank | Bank of memory to compact |
| orxDLLAPI void orxFASTCALL orxBank_CompactAll |
( |
) |
|
Compacts all banks by removing all their unused segments
| orxDLLAPI orxBANK* orxFASTCALL orxBank_Create |
( |
orxU16 |
_u16NbElem, |
|
|
orxU32 |
_u32Size, |
|
|
orxU32 |
_u32Flags, |
|
|
orxMEMORY_TYPE |
_eMemType |
|
) |
| |
Creates a new bank in memory and returns a pointer on it
- Parameters:
-
| [in] | _u16NbElem | Number of elements per segments |
| [in] | _u32Size | Size of an element |
| [in] | _u32Flags | Flags set for this bank |
| [in] | _eMemType | Memory type where the datas will be allocated |
- Returns:
- returns a pointer on the memory bank
| orxDLLAPI void orxFASTCALL orxBank_Delete |
( |
orxBANK * |
_pstBank ) |
|
Frees a portion of memory allocated with orxMemory_Allocate
- Parameters:
-
| [in] | _pstBank | Pointer on the memory bank allocated by orx |
| orxDLLAPI void orxFASTCALL orxBank_Exit |
( |
) |
|
Exits from the bank module
| orxDLLAPI void orxFASTCALL orxBank_Free |
( |
orxBANK * |
_pstBank, |
|
|
void * |
_pCell |
|
) |
| |
Frees an allocated cell
- Parameters:
-
| [in] | _pstBank | Bank of memory from where _pCell has been allocated |
| [in] | _pCell | Pointer on the cell to free |
- Returns:
- a new cell of memory (orxNULL if no allocation possible)
| orxDLLAPI void* orxFASTCALL orxBank_GetAtIndex |
( |
const orxBANK * |
_pstBank, |
|
|
orxU32 |
_u32Index |
|
) |
| |
Gets the cell at given index, orxNULL is the cell isn't allocated
- Parameters:
-
| [in] | _pstBank | Concerned memory bank |
| [in] | _u32Index | Index of the cell to retrieve |
- Returns:
- The cell at the given index if allocated, orxNULL otherwise
| orxDLLAPI orxU32 orxFASTCALL orxBank_GetCounter |
( |
const orxBANK * |
_pstBank ) |
|
Gets the bank allocated cell counter
- Parameters:
-
| [in] | _pstBank | Concerned bank |
- Returns:
- Number of allocated cells
| orxDLLAPI orxU32 orxFASTCALL orxBank_GetIndex |
( |
const orxBANK * |
_pstBank, |
|
|
const void * |
_pCell |
|
) |
| |
Gets the cell's index
- Parameters:
-
| [in] | _pstBank | Concerned memory bank |
| [in] | _pCell | Cell of which we want the index |
- Returns:
- The index of the given cell
| orxDLLAPI void* orxFASTCALL orxBank_GetNext |
( |
const orxBANK * |
_pstBank, |
|
|
const void * |
_pCell |
|
) |
| |
Gets the next cell
- Parameters:
-
| [in] | _pstBank | Bank of memory from where _pCell has been allocated |
| [in] | _pCell | Pointer on the current cell of memory |
- Returns:
- The next cell. If _pCell is orxNULL, the first cell will be returned. Returns orxNULL when no more cell can be returned.
| orxDLLAPI orxSTATUS orxFASTCALL orxBank_Init |
( |
) |
|
Inits the bank Module
- Returns:
- orxSTATUS_SUCCESS / orxSTATUS_FAILURE
| orxDLLAPI void orxFASTCALL orxBank_Setup |
( |
) |
|