Public Member Functions | |
CFX_BaseSegmentedArray (int unit_size=1, int segment_units=512, int index_size=8, IFX_Allocator *pAllocator=0) | |
Construct with specified unit size, segment units, and number of index levels. More... | |
~CFX_BaseSegmentedArray () | |
The destructor. | |
void * | Add () |
Add an element. More... | |
void | Delete (int index, int count=1) |
Delete a number of elements. More... | |
void * | GetAt (int index) const |
Get a typeless pointer to an element data. More... | |
int | GetSegmentSize () const |
Get number of elements in each segment. More... | |
int | GetSize () const |
Get number of elements in the array. More... | |
int | GetUnitSize () const |
Get number of bytes for each element. More... | |
void * | Iterate (FX_BOOL(*callback)(void *param, void *pData), void *param) const |
Iterate all units, with a callback function for each unit. More... | |
void | RemoveAll () |
Remove all elements in the array. More... | |
void | SetUnitSize (int unit_size, int segment_units, int index_size=8) |
Change the unit size and the segment units. This can only be called when array is empty. More... | |
Public Attributes | |
IFX_Allocator * | m_pAllocator |
Special allocator pointer. NULL means to use default allocator. | |
The class represents grow-able array with allocation in segments.
CFX_BaseSegmentedArray::CFX_BaseSegmentedArray | ( | int | unit_size = 1 , |
int | segment_units = 512 , |
||
int | index_size = 8 , |
||
IFX_Allocator * | pAllocator = 0 |
||
) |
Construct with specified unit size, segment units, and number of index levels.
[in] | unit_size | The specified unit size. |
[in] | segment_units | The count of units in each segment, must be less than 32768. |
[in] | index_size | The number of segments(index levels) in the array, it must be larger than 1 and less than 256. |
[in] | pAllocator | Allocator used in this class. NULL to use default allocator. |
void* CFX_BaseSegmentedArray::Add | ( | ) |
Add an element.
void CFX_BaseSegmentedArray::Delete | ( | int | index, |
int | count = 1 |
||
) |
Delete a number of elements.
[in] | index | Specifies the zero-based index of start element in the array to be deleted. |
[in] | count | Specifies the count of element to delete. |
void* CFX_BaseSegmentedArray::GetAt | ( | int | index | ) | const |
Get a typeless pointer to an element data.
[in] | index | Specifies the zero-based index of element. |
|
inline |
Get number of elements in each segment.
|
inline |
Get number of elements in the array.
|
inline |
Get number of bytes for each element.
void* CFX_BaseSegmentedArray::Iterate | ( | FX_BOOL(*)(void *param, void *pData) | callback, |
void * | param | ||
) | const |
Iterate all units, with a callback function for each unit.
[in] | callback | |
[in] | param |
void CFX_BaseSegmentedArray::RemoveAll | ( | ) |
Remove all elements in the array.
void CFX_BaseSegmentedArray::SetUnitSize | ( | int | unit_size, |
int | segment_units, | ||
int | index_size = 8 |
||
) |
Change the unit size and the segment units. This can only be called when array is empty.
[in] | unit_size | The new unit size. |
[in] | segment_units | The new count of units in each segment. |
[in] | index_size | The new number of index levels. |