AGX Dynamics 2.40.0.0
Loading...
Searching...
No Matches
agxData::LocalVector< T > Class Template Reference

Local scope vector. More...

#include <LocalVector.h>

+ Inheritance diagram for agxData::LocalVector< T >:

Public Member Functions

 LocalVector ()
 
 LocalVector (const LocalVector< T > &other)
 
 LocalVector (LocalVector< T > &&other)
 
 LocalVector (size_t size, const T &value=T())
 
- Public Member Functions inherited from agx::VectorPOD< T, agx::ThreadLocalAllocator >
 VectorPOD (const agx::ThreadLocalAllocator &allocator=agx::ThreadLocalAllocator())
 
 VectorPOD (const VectorPOD< T, agx::ThreadLocalAllocator > &other)
 
 VectorPOD (const_iterator first, const_iterator end, const agx::ThreadLocalAllocator &allocator=agx::ThreadLocalAllocator())
 
 VectorPOD (size_t size, const T &value=T(), const agx::ThreadLocalAllocator &allocator=agx::ThreadLocalAllocator())
 
 VectorPOD (std::initializer_list< T > values, const agx::ThreadLocalAllocator &allocator=agx::ThreadLocalAllocator())
 
 VectorPOD (VectorPOD< T, agx::ThreadLocalAllocator > &&other)
 
 ~VectorPOD ()
 
agx::ThreadLocalAllocatorallocator ()
 
const agx::ThreadLocalAllocatorallocator () const
 
T & at (size_t index) const
 
T & back () const
 
iterator begin ()
 
const_iterator begin () const
 
void clear (ClearPolicy policy=SHRINK_BUFFER_AVERAGED)
 Remove all elements, optionally with maintained buffer allocation.
 
bool contains (const T &element) const
 
bool contains (const T2 &element) const
 Test if the vector contains a certain element.
 
iterator end ()
 
const_iterator end () const
 
iterator erase (iterator position)
 STL erase functionality.
 
iterator erase (iterator start, iterator end)
 
void erase (size_t index)
 Erase elements using indices instead of iterators.
 
void erase (size_t start, size_t end)
 
iterator eraseFast (const_iterator position)
 Fast erase, replacing the erased element with the last element.
 
void eraseFast (size_t index)
 
size_t find (const T2 &element) const
 Find the index to a matching element, return size() if not found.
 
bool findAndErase (const T &element, bool searchMultiple=false)
 Find and erase an element.
 
T & front () const
 
T * increment (size_t numElements=1)
 Resize using a increment.
 
void insert (const_iterator it, InputIterator first, InputIterator last)
 
void insert (const_iterator it, std::initializer_list< T > ilist)
 
iterator insert (iterator position, const T &value)
 
void insert (size_t index, const T &value)
 
bool operator!= (const VectorPOD< T, agx::ThreadLocalAllocator > &other) const
 
VectorPOD< T, agx::ThreadLocalAllocator > & operator= (const VectorPOD< T, agx::ThreadLocalAllocator > &other)
 
bool operator== (const VectorPOD< T, agx::ThreadLocalAllocator > &other) const
 Compare with other vector, return true if same size and all pairs are equal.
 
T & operator[] (size_t i) const
 
void pop_back ()
 
T * ptr ()
 Get access to the internal data buffer.
 
const T * ptr () const
 
void push_back (const T &value)
 
void push_back (T &&value)
 
reverse_iterator rbegin ()
 
const_reverse_iterator rbegin () const
 
reverse_iterator rend ()
 
const_reverse_iterator rend () const
 
void reserve (size_t size)
 Reserve capacity in the vector.
 
void reserveAtLeast (size_t size)
 Reserve capacity in the vector.
 
void resize (size_t size)
 Resize the vector, which then enables direct addressing using the bracket '[]' operator.
 
void resize (size_t size, const T &value)
 
void shrink_to_fit ()
 Reduce the capacity of the vector to the actual size (number of elements)
 
void swap (VectorPOD &other)
 
- Public Member Functions inherited from agx::Container
size_t capacity () const
 Returns the size of the memory are used by the container to store its elements.
 
bool empty () const
 
void * ptr ()
 
const void * ptr () const
 
size_t size () const
 

Additional Inherited Members

- Public Types inherited from agx::VectorPOD< T, agx::ThreadLocalAllocator >
typedef const T * const_iterator
 
typedef const T * const_pointer
 
typedef const T & const_reference
 
typedef std::reverse_iterator< const_iteratorconst_reverse_iterator
 
typedef ptrdiff_t difference_type
 
typedef T * iterator
 
typedef T * pointer
 
typedef T & reference
 
typedef std::reverse_iterator< iteratorreverse_iterator
 
typedef size_t size_type
 
typedef T Type
 
typedef T value_type
 
- Public Types inherited from agx::Container
enum  ClearPolicy { SHRINK_BUFFER , SHRINK_BUFFER_AVERAGED , MAINTAIN_BUFFER }
 agxData::Values from this enumeration is passed to the subclasses' 'clear' method in order to control what should become of the container's memory. More...
 
- Protected Member Functions inherited from agx::Container
 Container ()
 
 Container (const Container &other)
 
 Container (Container &&other)
 
 ~Container ()
 
- Protected Attributes inherited from agx::Container
void * m_buffer
 
size_t m_capacity
 
size_t m_size
 

Detailed Description

template<typename T>
class agxData::LocalVector< T >

Local scope vector.

Fast allocation/deallocation using a thread local memory buffer.

Should only be used for local, short-lived, frequently created containers.

Beware that a LocalVector's allocation is unstable. All LocalVectors owned by the same thread get their memory allocations from the same memory pool. If the memory pool is exhausted then it is reallocated and ALL LocalVectors owned by that thread get a new buffer. In C++-speak, an operation that invalidates iterators/pointers into one LocalVectors invalidates pointers/iterators to ALL LocalVectors owned by the same thread. Avoid calling functions that may create LocalVectors when holding pointers/interators into LocalVectors, including using range for loops.

Definition at line 43 of file LocalVector.h.

Constructor & Destructor Documentation

◆ LocalVector() [1/4]

template<typename T >
agxData::LocalVector< T >::LocalVector

Definition at line 57 of file LocalVector.h.

◆ LocalVector() [2/4]

template<typename T >
agxData::LocalVector< T >::LocalVector ( size_t  size,
const T &  value = T() 
)

Definition at line 63 of file LocalVector.h.

◆ LocalVector() [3/4]

template<typename T >
agxData::LocalVector< T >::LocalVector ( const LocalVector< T > &  other)

Definition at line 69 of file LocalVector.h.

◆ LocalVector() [4/4]

template<typename T >
agxData::LocalVector< T >::LocalVector ( LocalVector< T > &&  other)
inline

Definition at line 75 of file LocalVector.h.


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