FBX C++ API Reference
|
Class for array of basic elements such as pointers and basic types. More...
#include <fbxarray.h>
Classes | |
struct | tData |
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 | ResizeUninitialized (const int pSize, bool pPreserveCapacityIfPossible=false) |
Inserts or erases elements at the end such that Size() becomes pSize, increasing capacity if needed. More... | |
bool | Resize (const int pSize, bool pPreserveCapacityIfPossible=false) |
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 * () const | |
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... | |
Protected Attributes | |
struct FbxArray::tData * | mData |
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 37 of file fbxarray.h.
typedef int(* CompareFunc) (const void *, const void *) |
Element compare function pointer definition.
Definition at line 52 of file fbxarray.h.
|
inline |
|
inline |
Reserve constructor.
Definition at line 58 of file fbxarray.h.
|
inline |
Destructor.
Definition at line 65 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 73 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 108 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 131 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 140 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 148 of file fbxarray.h.
|
inline |
Retrieve the current allocated memory capacity of the array.
Definition at line 153 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 159 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 183 of file fbxarray.h.
|
inline |
Retrieve a copy of the first element.
Definition at line 191 of file fbxarray.h.
|
inline |
Retrieve a copy of the last element.
Definition at line 199 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 208 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 226 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 243 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 263 of file fbxarray.h.
|
inline |
Set the value of the first element.
pElement | The new value of the last element. |
Definition at line 275 of file fbxarray.h.
|
inline |
Set the value of the last element.
pElement | The new value of the last element. |
Definition at line 283 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 292 of file fbxarray.h.
|
inline |
Remove the first element in the array.
Definition at line 313 of file fbxarray.h.
|
inline |
Remove the last element in the array.
Definition at line 321 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 329 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 345 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. |
pPreserveCapacityIfPossible | If the new count will fit into the existing allocation, do not adjust the capacity. |
true
if the memory (re)allocation succeeded, false
otherwise. Definition at line 378 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. |
pPreserveCapacityIfPossible | If the new count will fit into the existing allocation, do not adjust the capacity. |
true
if the memory (re)allocation succeeded, false
otherwise. Definition at line 412 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 450 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 467 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 483 of file fbxarray.h.
|
inline |
Reset the number of element to zero and free the memory allocated.
Definition at line 490 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 501 of file fbxarray.h.
|
inline |
Get pointer to internal array of elements.
Definition at line 507 of file fbxarray.h.
|
inline |
Cast operator.
Definition at line 510 of file fbxarray.h.
|
inline |
Append another array at the end of this array.
pOther | The other array to append to this array. |
Definition at line 514 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 524 of file fbxarray.h.
|
inline |
Remove the elements of another array from this array is they are present.
pOther | Another array. |
Definition at line 534 of file fbxarray.h.
Operator to copy elements of an array.
Definition at line 544 of file fbxarray.h.
|
inline |
Operator to compare elements of an array.
true
if the two arrays are equal, otherwise false
. Definition at line 558 of file fbxarray.h.
|
protected |