#include <fbxdynamicarray.h>
template<typename Type, typename Allocator = FbxBaseAllocator>
class FbxDynamicArray< Type, Allocator >
Template class for dynamic array holding objects. 
- See also
- FbxStaticArray 
Definition at line 26 of file fbxdynamicarray.h.
◆ FbxDynamicArray() [1/3]
Default constructor. 
Definition at line 30 of file fbxdynamicarray.h.
   34         mAllocator(
sizeof(Type))
 
 
 
◆ FbxDynamicArray() [2/3]
Constructor. 
- Parameters
- 
  
    | pInitialSize | initial capacity of this array |  
 
Definition at line 40 of file fbxdynamicarray.h.
   44         mAllocator(
sizeof(Type))
 
void Reserve(const size_t pCount)
Assures that sufficient memory is allocated to hold n objects in the array, and increases the capacit...
 
 
◆ FbxDynamicArray() [3/3]
Copy constructor. 
Definition at line 54 of file fbxdynamicarray.h.
   58         mAllocator(
sizeof(Type))
    61         CopyArray(mArray, pArray.mArray, pArray.mSize);
 
void Reserve(const size_t pCount)
Assures that sufficient memory is allocated to hold n objects in the array, and increases the capacit...
 
 
◆ ~FbxDynamicArray()
Destructor. 
Definition at line 66 of file fbxdynamicarray.h.
   68         for( 
size_t i = 0; i < mSize; ++i )
    72         mAllocator.FreeMemory(mArray);
  
 
◆ Capacity()
  
  | 
        
          | size_t Capacity | ( |  | ) | const |  | inline | 
 
 
◆ Size()
◆ Reserve()
  
  | 
        
          | void Reserve | ( | const size_t | pCount | ) |  |  | inline | 
 
Assures that sufficient memory is allocated to hold n objects in the array, and increases the capacity if necessary. 
- Parameters
- 
  
    | pCount | Number of objects to reserve |  
 
Definition at line 89 of file fbxdynamicarray.h.
   91         if( pCount > mCapacity )
    94             Type* lNewArray = (Type*)mAllocator.AllocateRecords(pCount);
    95             MoveArray(lNewArray, mArray, mSize);
    96             mAllocator.FreeMemory(mArray);
  
 
◆ PushBack()
  
  | 
        
          | void PushBack | ( | const Type & | pItem, |  
          |  |  | const size_t | pNCopies = 1 |  
          |  | ) |  |  |  | inline | 
 
Appends n objects at the end of the array. 
- Parameters
- 
  
    | pItem | object to append |  | pNCopies | number of copies to append |  
 
Definition at line 105 of file fbxdynamicarray.h.
  107         if( mSize + pNCopies > mCapacity )
   109             size_t lNewSize = mCapacity + mCapacity / 2;    
   110             if( mSize + pNCopies > lNewSize )
   112                 lNewSize = mSize + pNCopies;
   116         FBX_ASSERT(mSize + pNCopies <= mCapacity);
   117         Fill(mArray + mSize, pItem, pNCopies);
 void Reserve(const size_t pCount)
Assures that sufficient memory is allocated to hold n objects in the array, and increases the capacit...
 
 
◆ Insert()
  
  | 
        
          | void Insert | ( | const size_t | pIndex, |  
          |  |  | const Type & | pItem, |  
          |  |  | const size_t | pNCopies = 1 |  
          |  | ) |  |  |  | inline | 
 
Inserts n objects at the specified position. 
- Parameters
- 
  
    | pIndex | position index |  | pItem | object to insert |  | pNCopies | number of copies to append |  
 
Definition at line 125 of file fbxdynamicarray.h.
  127         FBX_ASSERT(pIndex >= 0);
   128         FBX_ASSERT(pIndex <= mSize);
   133         else if( pIndex >= mSize )
   137         else if( mSize + pNCopies > mCapacity )
   139             size_t lNewSize = mCapacity + mCapacity / 2;    
   140             if( mSize + pNCopies > lNewSize )
   142                 lNewSize = mSize + pNCopies;
   145             Type* lNewArray = (Type*)mAllocator.AllocateRecords(lNewSize);
   146             MoveArray(lNewArray, mArray, pIndex); 
   147             Fill(lNewArray + pIndex, pItem, pNCopies); 
   148             MoveArray(lNewArray + pIndex + pNCopies, mArray + pIndex, mSize - pIndex); 
   149             mAllocator.FreeMemory(mArray);
   152             mCapacity = lNewSize;
   157             MoveArrayBackwards(mArray + pIndex + pNCopies, mArray + pIndex, mSize - pIndex);
   158             Fill(mArray + pIndex, pItem, pNCopies); 
 void PushBack(const Type &pItem, const size_t pNCopies=1)
Appends n objects at the end of the array. 
 
 
◆ PopBack()
  
  | 
        
          | void PopBack | ( | size_t | pNElements = 1 | ) |  |  | inline | 
 
Removes n objects at the end. 
- Parameters
- 
  
    | pNElements | number of objects to remove |  
 
Definition at line 165 of file fbxdynamicarray.h.
  167         FBX_ASSERT(pNElements <= mSize);
   168         for( 
size_t i = mSize - pNElements; i < mSize; ++i )
  
 
◆ Remove()
  
  | 
        
          | void Remove | ( | const size_t | pIndex, |  
          |  |  | size_t | pNElements = 1 |  
          |  | ) |  |  |  | inline | 
 
Removes n objects at the specified position. 
- Parameters
- 
  
    | pIndex | position index |  | pNElements | number of objects to remove |  
 
Definition at line 178 of file fbxdynamicarray.h.
  180         FBX_ASSERT(pIndex >= 0);
   181         FBX_ASSERT(pIndex <= mSize);
   182         FBX_ASSERT(pIndex + pNElements <= mSize);
   183         if( pIndex + pNElements >= mSize )
   189             for( 
size_t i = pIndex; i < pIndex + pNElements; ++i )
   193             MoveOverlappingArray(&mArray[pIndex], &mArray[pIndex + pNElements], mSize - pIndex - pNElements);
 void PopBack(size_t pNElements=1)
Removes n objects at the end. 
 
 
◆ operator[]() [1/2]
  
  | 
        
          | Type& operator[] | ( | const size_t | pIndex | ) |  |  | inline | 
 
Gets nth object in the array. 
- Parameters
- 
  
  
Definition at line 200 of file fbxdynamicarray.h.
  202         return mArray[pIndex];
  
 
◆ operator[]() [2/2]
  
  | 
        
          | const Type& operator[] | ( | const size_t | pIndex | ) | const |  | inline | 
 
Gets nth object in the array. 
- Parameters
- 
  
  
Definition at line 207 of file fbxdynamicarray.h.
  209         return mArray[pIndex];
  
 
◆ First() [1/2]
Retrieve the first item in the array. 
- Returns
- The first item in the array. 
Definition at line 214 of file fbxdynamicarray.h.
Type & operator[](const size_t pIndex)
Gets nth object in the array. 
 
 
◆ First() [2/2]
  
  | 
        
          | const Type& First | ( |  | ) | const |  | inline | 
 
Retrieve the first item in the array. 
- Returns
- The first item in the array. 
Definition at line 221 of file fbxdynamicarray.h.
Type & operator[](const size_t pIndex)
Gets nth object in the array. 
 
 
◆ Last() [1/2]
Retrieve the last item in the array. 
- Returns
- The last item in the array. 
Definition at line 228 of file fbxdynamicarray.h.
Type & operator[](const size_t pIndex)
Gets nth object in the array. 
 
 
◆ Last() [2/2]
  
  | 
        
          | const Type& Last | ( |  | ) | const |  | inline | 
 
Retrieve the last item in the array. 
- Returns
- The last item in the array. 
Definition at line 235 of file fbxdynamicarray.h.
Type & operator[](const size_t pIndex)
Gets nth object in the array. 
 
 
◆ Find()
  
  | 
        
          | size_t Find | ( | const Type & | pItem, |  
          |  |  | const size_t | pStartIndex = 0 |  
          |  | ) |  | const |  | inline | 
 
Find first matching element, from first to last. 
- Parameters
- 
  
    | pItem | The item to try to find in the array. |  | pStartIndex | The index to start searching from. |  
 
- Returns
- Index of the first matching item, otherwise returns -1 (equivalent of SIZE_MAX for size_t). 
Definition at line 244 of file fbxdynamicarray.h.
  246         for( 
size_t i = pStartIndex; i < mSize; ++i )
   248             if( 
operator[](i) == pItem ) 
return i;
  
 
◆ operator=()
Assignment operator. 
Definition at line 255 of file fbxdynamicarray.h.
  258         CopyArray(mArray, pArray.mArray, pArray.mSize);
   259         mSize = pArray.mSize;
 void Reserve(const size_t pCount)
Assures that sufficient memory is allocated to hold n objects in the array, and increases the capacit...
 
 
The documentation for this class was generated from the following file: