![]() |
Polygon Crucher SDK - Documentation
Documentation
|
An advanced array class containing data that needs to be construct / destruct. More...
An advanced array class containing data that needs to be construct / destruct.
CElementMethods provides some information about the data contained in the array.
#include <ElementArray.h>
Public Types | |
enum | GrowMode { GROW_DEFAULT = 0 , GROW_KEEP_MODE = -1 , GROW_DOUBLE_SIZE = -2 } |
typedef enum CElementArray::GrowMode | GrowMode |
Public Member Functions | |
CElementArray (CElementMethods *methods) | |
Create an array. methods can be set to NULL when serializing (CElementMethods are created on the fly) or if SetMethods is called just after creation. | |
void | SetMethods (CElementMethods *methods) |
ElementType | GetBaseTypeOfElement () const |
ElementType | GetTypeOfElement () const |
SIZET | GetSizeOfElement () const |
void | FreeExtra () |
int | SetGrowFactor (int nGrowBy) |
void | PreAllocate (int estimatedSize) |
void | ConstructMode (bool constructAllOnce) |
virtual void | SetSize (int nNewSize, bool growOnly=false, int nGrowBy=GROW_KEEP_MODE) |
virtual void | Serialize (CXArchive &ar) |
int | GetSize () const |
int | GetUpperBound () const |
virtual void | RemoveAll () |
void | SetAt (int nIndex, const void *newElement) |
void * | ElementAt (int nIndex) |
const void * | ElementAt (int nIndex) const |
const void * | GetFirst () const |
const void * | GetNext (const void *ptrObject) const |
void * | GetFirst () |
void * | GetNext (void *ptrObject) |
int | Add (const void *newElement, int nGrowBy=GROW_KEEP_MODE) |
void | SetAtGrow (int nIndex, const void *newElement, int nGrowBy=GROW_KEEP_MODE) |
void * | operator[] (int nIndex) |
const void * | operator[] (int nIndex) const |
int | Append (const CElementArray &src, bool growOnly=false) |
bool | Copy (const CElementArray &src, bool growOnly=false) |
bool | Copy (int dstindex, int srcindex, const CElementArray &src) |
virtual CElementArray * | Duplicate (bool copydata) const |
void | InsertAt (int nIndex, void *newElement, int nCount=1) |
void | RemoveAt (int nIndex, int nCount=1) |
void | InsertAt (int nStartIndex, CElementArray *pNewArray) |
bool | Reorder (const unsigned int *reforder, unsigned int size, bool moveToDestinationIndexes) |
unsigned int | GetChecksum () const |
Return a checksum value made by bitwise operator that is a simple way to check if content changed between 2 calls. | |
GrowMode control the way the array inflate while adding data.
Can be use after Preallocate(XX) or SetSize(XX). This allow to construct all XX objects only once. Calling SetSize(YY, true) allow to resized down or up (to XX) without construction / destruction of elements. As element are construct once, elements can be leaved in an unknown state so this is to be used carefully. The mode remains valid until FreeExtra or ConstructMode(false) to go back to a normal mode
Preallocate array. GetSize() return 0. When filling the array, SetSize must be called with growOnly = true, otherwise array will be resized loosing the preallocation advantage
|
virtual |
Set the new size of the array If the array is to small, the array size if increased by a factor depending on nGrowBy mode. If the array is too big, the array is resized unless growOnly = true if newSize = 0, the array is freed whatever growOnly value.
Reimplemented in CPointList.