Base class for SimpleArray.
More...
|
eError | append (const void *pData, uintptr_t uCount) noexcept |
| Append an array of object to this array.
|
|
|
void * | m_pData |
| Pointer to the array of class instances.
|
|
uintptr_t | m_uSize |
| Number of active elements in the array.
|
|
uintptr_t | m_uBufferSize |
| Maximum number of elements in the array.
|
|
uintptr_t | m_uChunkSize |
| Size in bytes for each individual element in the array.
|
|
Base class for SimpleArray.
This class will perform most work for the SimpleArray template class
- See also
- SimpleArray or ClassArray
◆ SimpleArrayBase() [1/3]
Burger::SimpleArrayBase::SimpleArrayBase |
( |
uintptr_t | uChunkSize | ) |
|
|
inlinenoexcept |
◆ SimpleArrayBase() [2/3]
Burger::SimpleArrayBase::SimpleArrayBase |
( |
uintptr_t | uChunkSize, |
|
|
uintptr_t | uDefault ) |
|
noexcept |
Default constructor with a starting array and chunk size.
Initializes the array to contain uDefault number of uninitialized members.
- Note
- If the initial buffer allocation fails, the array size will be set to zero.
- Parameters
-
uChunkSize | Size of each data chunk |
uDefault | Number of members to create the array with. Zero will generate an empty array. |
- See also
- SimpleArrayBase(uintptr_t) or SimpleArrayBase(const SimpleArrayBase&)
◆ SimpleArrayBase() [3/3]
◆ ~SimpleArrayBase()
Burger::SimpleArrayBase::~SimpleArrayBase |
( |
void | | ) |
|
◆ append()
Append an array of object to this array.
Given a base pointer and an object count, iterate over the objects and copy them to the end of this array. This function will increase the size of the buffer if needed.
- Parameters
-
pData | Pointer to the first element in an array of objects |
uCount | Number of elements in the array |
- Returns
- Zero on success, or non zero on failure
- See also
- resize(uintptr_t) or reserve(uintptr_t)
◆ clear()
void BURGER_API Burger::SimpleArrayBase::clear |
( |
void | | ) |
|
|
noexcept |
◆ operator=()
Copy an array into this one.
If the copy is not itself, call clear() to erase the contents of this class and make a duplicate of every entry in the rData class into this one.
- Parameters
-
- Returns
- *this
- See also
- resize(uintptr_t) or reserve(uintptr_t)
◆ remove_at()
Remove an object from the array.
Call the destructor on the specific object in the array and then compact the array if needed.
- Parameters
-
uIndex | Index into the array of the object to remove. |
- Returns
- Zero on success, or non zero on failure
- See also
- resize(uintptr_t) or reserve(uintptr_t)
◆ reserve()
Resize the memory used by the array.
This function sets the size of the master buffer which can exceed the number of valid entries in the array. This is a performance function in that if it's known at runtime what is the maximum memory requirements for this array, it can be pre-allocated and all functions can use this buffer until the class is disposed of without any intermediate memory allocation calls.
If the reservation size is zero, the array is released.
The array size will be adjusted to the match the buffer size.
- Parameters
-
uNewBufferSize | Size in elements of the memory buffer. |
- Returns
- Zero on success, or non zero on failure
- See also
- clear(void) or resize(uintptr_t)
◆ resize()
Resize the valid entry count of the array.
If uNewSize is zero, erase all data. If uNewSize increases the size of the array, increase the buffer size if necessary. If the size is smaller than the existing array, truncate the array.
In some cases, the buffer size will be reduced if the new size is substantially smaller.
- Parameters
-
uNewSize | Number of valid objects the new array will contain. |
- Returns
- Zero on success, or non zero on failure
- See also
- clear(void) or reserve(uintptr_t)
◆ m_pData
void* Burger::SimpleArrayBase::m_pData |
|
protected |
Pointer to the array of class instances.
◆ m_uBufferSize
uintptr_t Burger::SimpleArrayBase::m_uBufferSize |
|
protected |
Maximum number of elements in the array.
◆ m_uChunkSize
uintptr_t Burger::SimpleArrayBase::m_uChunkSize |
|
protected |
Size in bytes for each individual element in the array.
◆ m_uSize
uintptr_t Burger::SimpleArrayBase::m_uSize |
|
protected |
Number of active elements in the array.