Bullet Collision Detection & Physics Library: btAlignedObjectArray< T > Class Template Reference

Bullet Collision Detection & Physics Library

Classes | Public Member Functions | Protected Member Functions | Private Attributes | List of all members
btAlignedObjectArray< T > Class Template Reference

The btAlignedObjectArray template class uses a subset of the stl::vector interface for its methods It is developed to replace stl::vector to avoid portability issues, including STL alignment issues to add SIMD/SSE data. More...

`#include <btAlignedObjectArray.h>`

Collaboration diagram for btAlignedObjectArray< T >:
[legend]

## Classes
class | less

## Public Member Functions
btAlignedObjectArray< T > & | operator= (const btAlignedObjectArray< T > &other)
| btAlignedObjectArray ()
| ~btAlignedObjectArray ()
| btAlignedObjectArray (const btAlignedObjectArray &otherArray)
| Generally it is best to avoid using the copy constructor of an btAlignedObjectArray, and use a (const) reference to the array instead. More...
int | size () const
| return the number of elements in the array More...
const T & | at (int n) const
T & | at (int n)
const T & | operator[] (int n) const
T & | operator[] (int n)
void | clear ()
| clear the array, deallocated memory. Generally it is better to use array.resize(0), to reduce performance overhead of run-time memory (de)allocations. More...
void | pop_back ()
void | resizeNoInitialize (int newsize)
| resize changes the number of elements in the array. More...
void | resize (int newsize, const T &fillData=T())
T & | expandNonInitializing ()
T & | expand (const T &fillValue=T())
void | push_back (const T &_Val)
int | capacity () const
| return the pre-allocated (reserved) elements, this is at least as large as the total number of elements,see size() and reserve() More...
void | reserve (int _Count)
template<typename L >
void | quickSortInternal (const L &CompareFunc, int lo, int hi)
template<typename L >
void | quickSort (const L &CompareFunc)
template<typename L >
void | downHeap (T *pArr, int k, int n, const L &CompareFunc)
| heap sort from http://www.csse.monash.edu.au/~lloyd/tildeAlgDS/Sort/Heap/ More...
void | swap (int index0, int index1)
template<typename L >
void | heapSort (const L &CompareFunc)
int | findBinarySearch (const T &key) const
| non-recursive binary search, assumes sorted array More...
int | findLinearSearch (const T &key) const
int | findLinearSearch2 (const T &key) const
void | removeAtIndex (int index)
void | remove (const T &key)
void | initializeFromBuffer (void *buffer, int size, int capacity)
void | copyFromArray (const btAlignedObjectArray &otherArray)

## Protected Member Functions
int | allocSize (int size)
void | copy (int start, int end, T *dest) const
void | init ()
void | destroy (int first, int last)
void * | allocate (int size)
void | deallocate ()

## Private Attributes
btAlignedAllocator< T, 16 > | m_allocator
int | m_size
int | m_capacity
T * | m_data
bool | m_ownsMemory

## Detailed Description

### template<typename T>
class btAlignedObjectArray< T >

The btAlignedObjectArray template class uses a subset of the stl::vector interface for its methods It is developed to replace stl::vector to avoid portability issues, including STL alignment issues to add SIMD/SSE data.

Definition at line 52 of file btAlignedObjectArray.h.

## Constructor & Destructor Documentation

## ◆ btAlignedObjectArray() [1/2]

template<typename T>

btAlignedObjectArray< T >::btAlignedObjectArray | ( |  | ) |
| inline

Definition at line 128 of file btAlignedObjectArray.h.

## ◆ ~btAlignedObjectArray()

template<typename T>

btAlignedObjectArray< T >::~btAlignedObjectArray | ( |  | ) |
| inline

Definition at line 133 of file btAlignedObjectArray.h.

## ◆ btAlignedObjectArray() [2/2]

template<typename T>

btAlignedObjectArray< T >::btAlignedObjectArray | ( | const btAlignedObjectArray< T > & | otherArray | ) |
| inline

Generally it is best to avoid using the copy constructor of an btAlignedObjectArray, and use a (const) reference to the array instead.

Definition at line 139 of file btAlignedObjectArray.h.

## Member Function Documentation

## ◆ allocate()

template<typename T>

void* btAlignedObjectArray< T >::allocate | ( | int | size | ) |
| inlineprotected

Definition at line 107 of file btAlignedObjectArray.h.

## ◆ allocSize()

template<typename T>

int btAlignedObjectArray< T >::allocSize | ( | int | size | ) |
| inlineprotected

Definition at line 75 of file btAlignedObjectArray.h.

## ◆ at() [1/2]

template<typename T>

const T& btAlignedObjectArray< T >::at | ( | int | n | ) | const
| inline

Definition at line 154 of file btAlignedObjectArray.h.

## ◆ at() [2/2]

template<typename T>

T& btAlignedObjectArray< T >::at | ( | int | n | ) |
| inline

Definition at line 161 of file btAlignedObjectArray.h.

## ◆ capacity()

template<typename T>

int btAlignedObjectArray< T >::capacity | ( |  | ) | const
| inline

return the pre-allocated (reserved) elements, this is at least as large as the total number of elements,see size() and reserve()

Definition at line 282 of file btAlignedObjectArray.h.

## ◆ clear()

template<typename T>

void btAlignedObjectArray< T >::clear | ( |  | ) |
| inline

clear the array, deallocated memory. Generally it is better to use array.resize(0), to reduce performance overhead of run-time memory (de)allocations.

Definition at line 183 of file btAlignedObjectArray.h.

## ◆ copy()

template<typename T>

void btAlignedObjectArray< T >::copy | ( | int | start,
|  | int | end,
|  | T * | dest
| ) |  | const
| inlineprotected

Definition at line 79 of file btAlignedObjectArray.h.

## ◆ copyFromArray()

template<typename T>

void btAlignedObjectArray< T >::copyFromArray | ( | const btAlignedObjectArray< T > & | otherArray | ) |
| inline

Definition at line 503 of file btAlignedObjectArray.h.

## ◆ deallocate()

template<typename T>

void btAlignedObjectArray< T >::deallocate | ( |  | ) |
| inlineprotected

Definition at line 114 of file btAlignedObjectArray.h.

## ◆ destroy()

template<typename T>

void btAlignedObjectArray< T >::destroy | ( | int | first,
|  | int | last
| ) |  |
| inlineprotected

Definition at line 98 of file btAlignedObjectArray.h.

## ◆ downHeap()

template<typename T>
template<typename L >

void btAlignedObjectArray< T >::downHeap | ( | T * | pArr,
|  | int | k,
|  | int | n,
|  | const L & | CompareFunc
| ) |  |
| inline

heap sort from http://www.csse.monash.edu.au/~lloyd/tildeAlgDS/Sort/Heap/

Definition at line 359 of file btAlignedObjectArray.h.

## ◆ expand()

template<typename T>

T& btAlignedObjectArray< T >::expand | ( | const T & | fillValue = `T()` | ) |
| inline

Definition at line 249 of file btAlignedObjectArray.h.

## ◆ expandNonInitializing()

template<typename T>

T& btAlignedObjectArray< T >::expandNonInitializing | ( |  | ) |
| inline

Definition at line 237 of file btAlignedObjectArray.h.

## ◆ findBinarySearch()

template<typename T>

int btAlignedObjectArray< T >::findBinarySearch | ( | const T & | key | ) | const
| inline

non-recursive binary search, assumes sorted array

Definition at line 426 of file btAlignedObjectArray.h.

## ◆ findLinearSearch()

template<typename T>

int btAlignedObjectArray< T >::findLinearSearch | ( | const T & | key | ) | const
| inline

Definition at line 445 of file btAlignedObjectArray.h.

## ◆ findLinearSearch2()

template<typename T>

int btAlignedObjectArray< T >::findLinearSearch2 | ( | const T & | key | ) | const
| inline

Definition at line 463 of file btAlignedObjectArray.h.

## ◆ heapSort()

template<typename T>
template<typename L >

void btAlignedObjectArray< T >::heapSort | ( | const L & | CompareFunc | ) |
| inline

Definition at line 404 of file btAlignedObjectArray.h.

## ◆ init()

template<typename T>

void btAlignedObjectArray< T >::init | ( |  | ) |
| inlineprotected

Definition at line 90 of file btAlignedObjectArray.h.

## ◆ initializeFromBuffer()

template<typename T>

void btAlignedObjectArray< T >::initializeFromBuffer | ( | void * | buffer,
|  | int | size,
|  | int | capacity
| ) |  |
| inline

Definition at line 494 of file btAlignedObjectArray.h.

## ◆ operator=()

template<typename T>

btAlignedObjectArray<T>& btAlignedObjectArray< T >::operator= | ( | const btAlignedObjectArray< T > & | other | ) |
| inline

Definition at line 64 of file btAlignedObjectArray.h.

## ◆ operator[]() [1/2]

template<typename T>

const T& btAlignedObjectArray< T >::operator[] | ( | int | n | ) | const
| inline

Definition at line 168 of file btAlignedObjectArray.h.

## ◆ operator[]() [2/2]

template<typename T>

T& btAlignedObjectArray< T >::operator[] | ( | int | n | ) |
| inline

Definition at line 175 of file btAlignedObjectArray.h.

## ◆ pop_back()

template<typename T>

void btAlignedObjectArray< T >::pop_back | ( |  | ) |
| inline

Definition at line 192 of file btAlignedObjectArray.h.

## ◆ push_back()

template<typename T>

void btAlignedObjectArray< T >::push_back | ( | const T & | _Val | ) |
| inline

Definition at line 264 of file btAlignedObjectArray.h.

## ◆ quickSort()

template<typename T>
template<typename L >

void btAlignedObjectArray< T >::quickSort | ( | const L & | CompareFunc | ) |
| inline

Definition at line 348 of file btAlignedObjectArray.h.

## ◆ quickSortInternal()

template<typename T>
template<typename L >

void btAlignedObjectArray< T >::quickSortInternal | ( | const L & | CompareFunc,
|  | int | lo,
|  | int | hi
| ) |  |
| inline

Definition at line 318 of file btAlignedObjectArray.h.

## ◆ remove()

template<typename T>

void btAlignedObjectArray< T >::remove | ( | const T & | key | ) |
| inline

Definition at line 487 of file btAlignedObjectArray.h.

## ◆ removeAtIndex()

template<typename T>

void btAlignedObjectArray< T >::removeAtIndex | ( | int | index | ) |
| inline

Definition at line 479 of file btAlignedObjectArray.h.

## ◆ reserve()

template<typename T>

void btAlignedObjectArray< T >::reserve | ( | int | _Count | ) |
| inline

Definition at line 287 of file btAlignedObjectArray.h.

## ◆ resize()

template<typename T>

void btAlignedObjectArray< T >::resize | ( | int | newsize,
|  | const T & | fillData = `T()`
| ) |  |
| inline

Definition at line 210 of file btAlignedObjectArray.h.

## ◆ resizeNoInitialize()

template<typename T>

void btAlignedObjectArray< T >::resizeNoInitialize | ( | int | newsize | ) |
| inline

resize changes the number of elements in the array.

If the new size is larger, the new elements will be constructed using the optional second argument. when the new number of elements is smaller, the destructor will be called, but memory will not be freed, to reduce performance overhead of run-time memory (de)allocations.

Definition at line 201 of file btAlignedObjectArray.h.

## ◆ size()

template<typename T>

int btAlignedObjectArray< T >::size | ( |  | ) | const
| inline

return the number of elements in the array

Definition at line 149 of file btAlignedObjectArray.h.

## ◆ swap()

template<typename T>

void btAlignedObjectArray< T >::swap | ( | int | index0,
|  | int | index1
| ) |  |
| inline

Definition at line 389 of file btAlignedObjectArray.h.

## Member Data Documentation

## ◆ m_allocator

template<typename T>

btAlignedAllocator<T, 16> btAlignedObjectArray< T >::m_allocator
| private

Definition at line 54 of file btAlignedObjectArray.h.

## ◆ m_capacity

template<typename T>

int btAlignedObjectArray< T >::m_capacity
| private

Definition at line 57 of file btAlignedObjectArray.h.

## ◆ m_data

template<typename T>

T* btAlignedObjectArray< T >::m_data
| private

Definition at line 58 of file btAlignedObjectArray.h.

## ◆ m_ownsMemory

template<typename T>

bool btAlignedObjectArray< T >::m_ownsMemory
| private

Definition at line 60 of file btAlignedObjectArray.h.

## ◆ m_size

template<typename T>

int btAlignedObjectArray< T >::m_size
| private

Definition at line 56 of file btAlignedObjectArray.h.

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

- btAlignedObjectArray.h