| Bullet Collision Detection & Physics Library
    | 
 
 
 
Go to the documentation of this file.
   16 #ifndef BT_OBJECT_ARRAY__ 
   17 #define BT_OBJECT_ARRAY__ 
   28 #define BT_USE_PLACEMENT_NEW 1 
   30 #define BT_ALLOW_ARRAY_COPY_OPERATOR  // enabling this can accidently perform deep copies of data if you are not careful 
   35 #endif  //BT_USE_MEMCPY 
   37 #ifdef BT_USE_PLACEMENT_NEW 
   39 #endif          //BT_USE_PLACEMENT_NEW 
   42 #if __cplusplus > 199711L 
   45 #define BT_REGISTER register 
   62 #ifdef BT_ALLOW_ARRAY_COPY_OPERATOR 
   69 #else   //BT_ALLOW_ARRAY_COPY_OPERATOR 
   72 #endif  //BT_ALLOW_ARRAY_COPY_OPERATOR 
   82                 for (i = start; i < end; ++i)
 
   84                         new (&dest[i]) T(
m_data[i]);
 
   87 #endif  //BT_USE_PLACEMENT_NEW 
  101                 for (i = first; i < last; i++)
 
  143                 int otherSize = otherArray.
size();
 
  203                 if (newsize > 
size())
 
  214                 if (newsize < curSize)
 
  216                         for (
int i = newsize; i < curSize; i++)
 
  223                         if (newsize > curSize)
 
  227 #ifdef BT_USE_PLACEMENT_NEW 
  228                         for (
int i = curSize; i < newsize; i++)
 
  230                                 new (&
m_data[i]) T(fillData);
 
  232 #endif  //BT_USE_PLACEMENT_NEW 
  257 #ifdef BT_USE_PLACEMENT_NEW 
  258                 new (&
m_data[sz]) T(fillValue);  
 
  272 #ifdef BT_USE_PLACEMENT_NEW 
  276 #endif  //BT_USE_PLACEMENT_NEW 
  317         template <
typename L>
 
  323                 T x = 
m_data[(lo + hi) / 2];
 
  328                         while (CompareFunc(
m_data[i], x))
 
  330                         while (CompareFunc(x, 
m_data[j]))
 
  347         template <
typename L>
 
  358         template <
typename L>
 
  359         void downHeap(T* pArr, 
int k, 
int n, 
const L& CompareFunc)
 
  364                 T temp = pArr[k - 1];
 
  370                         if ((child < n) && CompareFunc(pArr[child - 1], pArr[child]))
 
  375                         if (CompareFunc(temp, pArr[child - 1]))
 
  378                                 pArr[k - 1] = pArr[child - 1];
 
  389         void swap(
int index0, 
int index1)
 
  392                 char temp[
sizeof(T)];
 
  393                 memcpy(temp, &
m_data[index0], 
sizeof(T));
 
  395                 memcpy(&
m_data[index1], temp, 
sizeof(T));
 
  400 #endif  //BT_USE_PLACEMENT_NEW 
  403         template <
typename L>
 
  409                 for (k = n / 2; k > 0; k--)
 
  429                 int last = 
size() - 1;
 
  432                 while (first <= last)
 
  434                         int mid = (first + last) / 2;  
 
  437                         else if (key < 
m_data[mid])
 
  450                 for (i = 0; i < 
size(); i++)
 
  468                 for (i = 0; i < 
size(); i++)
 
  505                 int otherSize = otherArray.
size();
 
  511 #endif  //BT_OBJECT_ARRAY__ 
  
btAlignedAllocator< T, 16 > m_allocator
void * allocate(int size)
void heapSort(const L &CompareFunc)
const T & operator[](int n) const
void destroy(int first, int last)
void quickSortInternal(const L &CompareFunc, int lo, int hi)
void copyFromArray(const btAlignedObjectArray &otherArray)
void quickSort(const L &CompareFunc)
int findLinearSearch(const T &key) const
void clear()
clear the array, deallocated memory. Generally it is better to use array.resize(0),...
void copy(int start, int end, T *dest) const
void downHeap(T *pArr, int k, int n, const L &CompareFunc)
heap sort from http://www.csse.monash.edu.au/~lloyd/tildeAlgDS/Sort/Heap/
btAlignedObjectArray(const btAlignedObjectArray &otherArray)
Generally it is best to avoid using the copy constructor of an btAlignedObjectArray,...
void swap(int index0, int index1)
void initializeFromBuffer(void *buffer, int size, int capacity)
void resize(int newsize, const T &fillData=T())
void removeAtIndex(int index)
The btAlignedObjectArray template class uses a subset of the stl::vector interface for its methods It...
bool operator()(const T &a, const T &b) const
pointer allocate(size_type n, const_pointer *hint=0)
#define SIMD_FORCE_INLINE
int findBinarySearch(const T &key) const
non-recursive binary search, assumes sorted array
void deallocate(pointer ptr)
T & expand(const T &fillValue=T())
int capacity() const
return the pre-allocated (reserved) elements, this is at least as large as the total number of elemen...
void resizeNoInitialize(int newsize)
resize changes the number of elements in the array.
btAlignedObjectArray< T > & operator=(const btAlignedObjectArray< T > &other)
#define BT_USE_PLACEMENT_NEW
If the platform doesn't support placement new, you can disable BT_USE_PLACEMENT_NEW then the btAligne...
void push_back(const T &_Val)
int findLinearSearch2(const T &key) const
void remove(const T &key)
T & expandNonInitializing()
const T & at(int n) const
int size() const
return the number of elements in the array