Polygon Crucher SDK - Documentation
Documentation
Loading...
Searching...
No Matches
CXArray< TYPE, ARG_TYPE > Class Template Reference

CXArray is an array of simple data information which does not requires to call a constructor / destructor. More...

Detailed Description

template<class TYPE, class ARG_TYPE = const TYPE&>
class CXArray< TYPE, ARG_TYPE >

CXArray is an array of simple data information which does not requires to call a constructor / destructor.

If you intend to manage array of more complex data, please look at CElementArray.

Parameters
TYPEspecified the data type stored in the array.

#include <XTemplate.h>

Inheritance diagram for CXArray< TYPE, ARG_TYPE >:

Public Types

enum  GrowMode { GROW_DEFAULT = 0 , GROW_KEEP_MODE = -1 , GROW_DOUBLE_SIZE = -2 }
 
typedef enum CXArray::GrowMode GrowMode
 

Public Member Functions

 CXArray (bool enableMemcpy=true)
 
 CXArray (const CXArray< TYPE, ARG_TYPE > &copyFrom)
 
int GetSizeOfElement () const
 
int GetSize () const
 
void SetSize (int newCount, int newGrowCount=GROW_KEEP_MODE)
 The buffer always grows unless FreeExtra / RemoveAll(false) is called.
 
void PreAllocate (int size, int newGrowCount=GROW_KEEP_MODE)
 Preallocate size elements. GetSize() return 0 after the call.
 
void FreeExtra ()
 Remove extra data allocated when adding data.
 
void RemoveAll (bool keepBuffer=false)
 Remove all data and set size to 0.
 
const TYPEGetData () const
 Get raw array const data access.
 
TYPEGetData ()
 Get raw array data access for modifying data directly.
 
void SetAtGrow (int index, ARG_TYPE newElement, int nGrowBy=GROW_KEEP_MODE)
 
int Add (ARG_TYPE newElement, int nGrowBy=GROW_KEEP_MODE)
 
int AddArray (const CXArray< TYPE, ARG_TYPE > &src)
 Add an array to another array. There might be duplicated items.
 
void Copy (const CXArray< TYPE, ARG_TYPE > &src)
 
void Copy (const CXArray< TYPE, ARG_TYPE > *src)
 
const TYPEoperator[] (int index) const
 
TYPEoperator[] (int index)
 
void InsertAt (int index, ARG_TYPE newElement, int insertCount=1)
 
void RemoveAt (int index, int removedCount=1)
 
bool Remove (ARG_TYPE newElement, bool firstonly=true)
 Remove newElement and return true if found. If firstonly = true, the return return once the first newElement has been removed.
 
void Serialize (CXArchive &)
 

Member Enumeration Documentation

◆ GrowMode

template<class TYPE , class ARG_TYPE = const TYPE&>
enum CXArray::GrowMode

GrowMode control the way the array inflate while adding data.

Enumerator
GROW_DEFAULT 

A default grow mode which increase the array size by 1024 bytes each times its needed. using it with SetSize(0) will free the buffer.

GROW_KEEP_MODE 

Keep the default grow size (SetAtGrow, SetSize)

GROW_DOUBLE_SIZE 

Double size the array for fast element growing (required when the final element number is not known, and is probably big)


The documentation for this class was generated from the following files: