FBX C++ API Reference
|
#include <fbxarray.h>
Class for array of basic elements such as pointers and basic types.
This class will not call constructor and destructor for elements, thus it is not suitable for object references. Memory allocations are always done in a single contiguous memory region.
Definition at line 23 of file fbxarray.h.
Public Types | |
typedef int(* | CompareFunc) (const void *, const void *) |
Element compare function pointer definition. More... | |
Public Member Functions | |
FbxArray () | |
Constructor. More... | |
FbxArray (const int pCapacity) | |
Reserve constructor. More... | |
FbxArray (const FbxArray &pArray) | |
Copy constructor. More... | |
~FbxArray () | |
Destructor. More... | |
int | InsertAt (const int pIndex, const T &pElement, bool pCompact=false) |
Insert an element at the given position, growing the array if capacity is not sufficient. More... | |
int | Add (const T &pElement) |
Append an element at the end of the array, doubling the array if capacity is not sufficient. More... | |
int | AddUnique (const T &pElement) |
Append an element at the end of array, if not already present, doubling the array if capacity is not sufficient. More... | |
int | AddCompact (const T &pElement) |
Append an element at the end of the array, growing the array by one element if capacity is not sufficient. More... | |
int | Size () const |
Retrieve the number of element contained in the array. More... | |
int | Capacity () const |
Retrieve the current allocated memory capacity of the array. More... | |
T & | operator[] (const int pIndex) const |
Retrieve a reference of the element at given index position in the array. More... | |
T | GetAt (const int pIndex) const |
Retrieve a copy of the element at given index position in the array. More... | |
T | GetFirst () const |
Retrieve a copy of the first element. More... | |
T | GetLast () const |
Retrieve a copy of the last element. More... | |
int | Find (const T &pElement, const int pStartIndex=0) const |
Find first matching element, from first to last. More... | |
int | FindReverse (const T &pElement, const int pStartIndex=0x7fffffff) const |
Find first matching element, from last to first. More... | |
bool | Reserve (const int pCapacity) |
Request for allocation of additional memory without inserting new elements. More... | |
void | SetAt (const int pIndex, const T &pElement) |
Set the element at given position in the array. More... | |
void | SetFirst (const T &pElement) |
Set the value of the first element. More... | |
void | SetLast (const T &pElement) |
Set the value of the last element. More... | |
T | RemoveAt (const int pIndex) |
Remove an element at the given position in the array. More... | |
T | RemoveFirst () |
Remove the first element in the array. More... | |
T | RemoveLast () |
Remove the last element in the array. More... | |
bool | RemoveIt (const T &pElement) |
Remove first matching element in the array. More... | |
void | RemoveRange (const int pIndex, const int pCount) |
Remove a range of elements at the given position in the array. More... | |
bool | Resize (const int pSize) |
Inserts or erases elements at the end such that Size() becomes pSize, increasing capacity if needed. More... | |
bool | Grow (const int pSize) |
Increase size of array by the specified size. More... | |
bool | Shrink (const int pSize) |
Reduce size of array by the specified size. More... | |
bool | Compact () |
Compact the array so that its capacity is the same as its size. More... | |
void | Clear () |
Reset the number of element to zero and free the memory allocated. More... | |
void | Sort (CompareFunc pCompareFunc) |
Sort the array using the specified compare function pointer. More... | |
T * | GetArray () const |
Get pointer to internal array of elements. More... | |
operator T* () | |
Cast operator. More... | |
void | AddArray (const FbxArray< T > &pOther) |
Append another array at the end of this array. More... | |
void | AddArrayNoDuplicate (const FbxArray< T > &pOther) |
Append the elements of another array at the end of this array if they are not present. More... | |
void | RemoveArray (const FbxArray< T > &pOther) |
Remove the elements of another array from this array is they are present. More... | |
FbxArray< T > & | operator= (const FbxArray< T > &pOther) |
Operator to copy elements of an array. More... | |
bool | operator== (const FbxArray< T > &pOther) const |
Operator to compare elements of an array. More... | |
typedef int(* CompareFunc) (const void *, const void *) |
Element compare function pointer definition.
Definition at line 27 of file fbxarray.h.
|
inline |
|
inline |
Reserve constructor.
Definition at line 33 of file fbxarray.h.
|
inline |
Destructor.
Definition at line 40 of file fbxarray.h.
|
inline |
Insert an element at the given position, growing the array if capacity is not sufficient.
pIndex | Position where to insert the element. Must be a positive value. |
pElement | Element to insert in the array. |
pCompact | If true and capacity is exceeded, grow capacity by one, otherwise double capacity (default). |
Definition at line 48 of file fbxarray.h.
|
inline |
Append an element at the end of the array, doubling the array if capacity is not sufficient.
pElement | Element to append to the array. |
Definition at line 83 of file fbxarray.h.
|
inline |
Append an element at the end of array, if not already present, doubling the array if capacity is not sufficient.
pElement | Element to append to the array. |
Definition at line 91 of file fbxarray.h.
|
inline |
Append an element at the end of the array, growing the array by one element if capacity is not sufficient.
pElement | Element to append to the array. |
Definition at line 100 of file fbxarray.h.
|
inline |
Retrieve the number of element contained in the array.
To increase the capacity without increasing the size, please use Reserve().
Definition at line 108 of file fbxarray.h.
|
inline |
Retrieve the current allocated memory capacity of the array.
Definition at line 113 of file fbxarray.h.
|
inline |
Retrieve a reference of the element at given index position in the array.
pIndex | Position of element in the array. |
Definition at line 119 of file fbxarray.h.
|
inline |
Retrieve a copy of the element at given index position in the array.
pIndex | Position of element in the array. |
Definition at line 139 of file fbxarray.h.
|
inline |
Retrieve a copy of the first element.
Definition at line 147 of file fbxarray.h.
|
inline |
Retrieve a copy of the last element.
Definition at line 155 of file fbxarray.h.
|
inline |
Find first matching element, from first to last.
pElement | The element to be compared to each of the elements. |
pStartIndex | The position to start searching from. |
Definition at line 164 of file fbxarray.h.
|
inline |
Find first matching element, from last to first.
pElement | The element to be compared to each of the elements. |
pStartIndex | The position to start searching from. |
Definition at line 178 of file fbxarray.h.
|
inline |
Request for allocation of additional memory without inserting new elements.
After the memory has been reserved, please use SetAt() to initialize elements.
pCapacity | The number of additional element memory allocation requested. |
true
if the memory allocation succeeded or if the capacity is unchanged, false
otherwise. Definition at line 191 of file fbxarray.h.
|
inline |
Set the element at given position in the array.
pIndex | Position of element in the array. |
pElement | The new element. |
Definition at line 212 of file fbxarray.h.
|
inline |
Set the value of the first element.
pElement | The new value of the last element. |
Definition at line 222 of file fbxarray.h.
|
inline |
Set the value of the last element.
pElement | The new value of the last element. |
Definition at line 230 of file fbxarray.h.
|
inline |
Remove an element at the given position in the array.
pIndex | Position of the element to remove. |
Definition at line 239 of file fbxarray.h.
|
inline |
Remove the first element in the array.
Definition at line 253 of file fbxarray.h.
|
inline |
Remove the last element in the array.
Definition at line 261 of file fbxarray.h.
|
inline |
Remove first matching element in the array.
pElement | Element to be removed. |
true
if a matching element is found and removed, false
otherwise. Definition at line 269 of file fbxarray.h.
|
inline |
Remove a range of elements at the given position in the array.
pIndex | Begin position of the elements to remove. |
pCount | The count of elements to remove. |
true
if successful, otherwise false
. Definition at line 284 of file fbxarray.h.
|
inline |
Inserts or erases elements at the end such that Size() becomes pSize, increasing capacity if needed.
Please use SetAt() to initialize any new elements.
pSize | The new count of elements to set the array to. Must be greater or equal to zero. |
true
if the memory (re)allocation succeeded, false
otherwise. Definition at line 299 of file fbxarray.h.
|
inline |
Increase size of array by the specified size.
pSize | The size to add to the array size. |
true
if operation succeeded, false
otherwise. Definition at line 330 of file fbxarray.h.
|
inline |
Reduce size of array by the specified size.
pSize | The size to remove from the array size. |
true
if operation succeeded, false
otherwise. Definition at line 338 of file fbxarray.h.
|
inline |
Compact the array so that its capacity is the same as its size.
true
if operation succeeded, false
otherwise. Definition at line 345 of file fbxarray.h.
|
inline |
Reset the number of element to zero and free the memory allocated.
Definition at line 352 of file fbxarray.h.
|
inline |
Sort the array using the specified compare function pointer.
pCompareFunc | The compare function to use to sort elements. |
Definition at line 365 of file fbxarray.h.
|
inline |
|
inline |
|
inline |
Append another array at the end of this array.
pOther | The other array to append to this array. |
Definition at line 378 of file fbxarray.h.
|
inline |
Append the elements of another array at the end of this array if they are not present.
pOther | Another array. |
Definition at line 388 of file fbxarray.h.
|
inline |
Remove the elements of another array from this array is they are present.
pOther | Another array. |
Definition at line 398 of file fbxarray.h.
Operator to copy elements of an array.
Definition at line 408 of file fbxarray.h.
|
inline |
Operator to compare elements of an array.
true
if the two arrays are equal, otherwise false
. Definition at line 422 of file fbxarray.h.