#include <TFreeList.h>
Definition at line 27 of file TFreeList.h.
◆ TFreeList()
TFreeList::TFreeList |
( |
TUINT | a_uiItemSize, |
|
|
TINT | a_iInitialSize, |
|
|
TINT | a_iGrowSize, |
|
|
const TCHAR * | a_pchName ) |
Definition at line 12 of file TFreeList.cpp.
13{
14 m_uiItemSize = a_uiItemSize;
15 m_iCapacity = 0;
16 m_pMemoryHeap =
TNULL;
20
21 m_pPrevList = ms_pLastList;
22 ms_pLastList = this;
23}
void SetGrowSize(TINT a_iGrowSize)
◆ Allocate()
Definition at line 25 of file TFreeList.cpp.
26{
28 m_iCapacity += a_iNumber;
29
31
32 pNewNode->pNext = m_RootNode.pNext;
33 m_RootNode.pNext = pNewNode;
34
35 auto pData = pNewNode + 1;
37
38 for (
TINT i = a_iNumber - 1; i != 0; i-- )
39 {
40 pData->pNext = pNext;
41 pNext = pData;
42
44 }
45
46 m_LastNode.
pNext = pNext;
47 return pData;
48}
void * TMalloc(TSIZE a_uiSize, Toshi::TMemory::MemBlock *a_pMemBlock, const TCHAR *a_szFileName, TINT a_iLineNum)
Allocates memory from a specific memory block.
#define TREINTERPRETCAST(TYPE, VALUE)
◆ Delete()
void TFreeList::Delete |
( |
void * | a_Ptr | ) |
|
Definition at line 81 of file TFreeList.cpp.
82{
84
85 if ( m_LastNode.pNext !=
TNULL )
86 {
87 pNode->pNext = m_LastNode.pNext;
88 m_LastNode.pNext = pNode;
89 }
90 else
91 {
92 m_LastNode.pNext = pNode;
94 }
95}
#define TSTATICCAST(POINTERTYPE, VALUE)
◆ GetCapacity()
TINT TFreeList::GetCapacity |
( |
| ) |
const |
|
inline |
Definition at line 41 of file TFreeList.h.
41{ return m_iCapacity; }
◆ GetGrowSize()
TINT TFreeList::GetGrowSize |
( |
| ) |
const |
|
inline |
Definition at line 42 of file TFreeList.h.
42{ return m_iGrowSize; }
◆ New()
void * TFreeList::New |
( |
TUINT | a_uiSize | ) |
|
Definition at line 61 of file TFreeList.cpp.
62{
63 if ( a_uiSize != m_uiItemSize )
64 {
66 }
67
68 auto pNode = m_LastNode.pNext;
69
71 {
72 m_LastNode.pNext = pNode->pNext;
73 return pNode;
74 }
75 else
76 {
77 return Allocate( m_iGrowSize, a_uiSize );
78 }
79}
Node * Allocate(TINT a_iNumber, TINT a_iSize)
◆ SetCapacity()
void TFreeList::SetCapacity |
( |
TINT | a_iNewCapacity | ) |
|
Definition at line 50 of file TFreeList.cpp.
51{
52 if ( m_iCapacity < a_iNewCapacity )
53 {
54 auto pNode =
Allocate( a_iNewCapacity - m_iCapacity, m_uiItemSize );
55
56 pNode->pNext = m_LastNode.pNext;
57 m_LastNode.pNext = pNode;
58 }
59}
◆ SetGrowSize()
void TFreeList::SetGrowSize |
( |
TINT | a_iGrowSize | ) |
|
|
inline |
Definition at line 44 of file TFreeList.h.
44{ a_iGrowSize < 0 ? m_iGrowSize = 8 : m_iGrowSize = a_iGrowSize; }
The documentation for this class was generated from the following files: