Kicking it Olde Sküül! Burgerlib on Github Follow Olde Sküül on Twitter Burgerbecky on LinkedIn Burgerbecky on LinkedIn
Loading...
Searching...
No Matches
Burger::SimpleArrayBase Class Reference

Base class for SimpleArray. More...

Inheritance diagram for Burger::SimpleArrayBase:

Public Member Functions

 SimpleArrayBase (uintptr_t uChunkSize) noexcept
 Default constructor.
 
 SimpleArrayBase (uintptr_t uChunkSize, uintptr_t uDefault) noexcept
 Default constructor with a starting array and chunk size.
 
 SimpleArrayBase (const SimpleArrayBase &rData) noexcept
 Default constructor for making a copy of another SimpleArrayBase.
 
 ~SimpleArrayBase ()
 Standard destructor.
 
SimpleArrayBaseoperator= (const SimpleArrayBase &rData) noexcept
 Copy an array into this one.
 
void clear (void) noexcept
 Remove all objects from the array.
 
eError remove_at (uintptr_t uIndex) noexcept
 Remove an object from the array.
 
eError resize (uintptr_t uNewSize) noexcept
 Resize the valid entry count of the array.
 
eError reserve (uintptr_t uNewBufferSize) noexcept
 Resize the memory used by the array.
 

Protected Member Functions

eError append (const void *pData, uintptr_t uCount) noexcept
 Append an array of object to this array.
 

Protected Attributes

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.
 

Detailed Description

Base class for SimpleArray.


This class will perform most work for the SimpleArray template class

See also
SimpleArray or ClassArray

Constructor & Destructor Documentation

◆ SimpleArrayBase() [1/3]

Burger::SimpleArrayBase::SimpleArrayBase ( uintptr_t uChunkSize)
inlinenoexcept

Default constructor.


Initializes the array to contain no data and have no members and set to a specific chunk size.

Parameters
uChunkSizeSize in bytes of each element in the array
See also
SimpleArrayBase(uintptr_t,uintptr_t) or SimpleArrayBase(const SimpleArrayBase&)

◆ 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
uChunkSizeSize of each data chunk
uDefaultNumber 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]

Burger::SimpleArrayBase::SimpleArrayBase ( const SimpleArrayBase & rData)
noexcept

Default constructor for making a copy of another SimpleArrayBase.


Initializes the array to contain a copy of another SimpleArrayBase.

Parameters
rDataReference to a matching SimpleArrayBase type
See also
SimpleArrayBase(uintptr_t) or SimpleArrayBase(uintptr_t,uintptr_t)

◆ ~SimpleArrayBase()

Burger::SimpleArrayBase::~SimpleArrayBase ( void )

Standard destructor.


Releases the memory buffer with a call to Free(const void *)

See also
SimpleArrayBase(uintptr_t), SimpleArrayBase(uintptr_t,uintptr_t) or SimpleArrayBase(const SimpleArrayBase&)

Member Function Documentation

◆ append()

Burger::eError BURGER_API Burger::SimpleArrayBase::append ( const void * pData,
uintptr_t uCount )
protectednoexcept

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
pDataPointer to the first element in an array of objects
uCountNumber 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

Remove all objects from the array.


Dispose of the array and set the size to zero.

See also
resize(uintptr_t) or reserve(uintptr_t)

◆ operator=()

Burger::SimpleArrayBase & Burger::SimpleArrayBase::operator= ( const SimpleArrayBase & rData)
noexcept

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
rDataReference to a matching SimpleArray type
Returns
*this
See also
resize(uintptr_t) or reserve(uintptr_t)

◆ remove_at()

Burger::eError BURGER_API Burger::SimpleArrayBase::remove_at ( uintptr_t uIndex)
noexcept

Remove an object from the array.


Call the destructor on the specific object in the array and then compact the array if needed.

Parameters
uIndexIndex 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()

Burger::eError BURGER_API Burger::SimpleArrayBase::reserve ( uintptr_t uNewBufferSize)
noexcept

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
uNewBufferSizeSize in elements of the memory buffer.
Returns
Zero on success, or non zero on failure
See also
clear(void) or resize(uintptr_t)

◆ resize()

Burger::eError BURGER_API Burger::SimpleArrayBase::resize ( uintptr_t uNewSize)
noexcept

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
uNewSizeNumber 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)

Member Data Documentation

◆ 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.