AGXDynamics  2.31.1.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
agx::VectorPOD< T, Allocator > Class Template Reference

Vector containing 'raw' data. More...

#include <Vector.h>

+ Inheritance diagram for agx::VectorPOD< T, Allocator >:

Public Types

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...
 
typedef const T * const_iterator
 
typedef const T * const_pointer
 
typedef const T & const_reference
 
typedef std::reverse_iterator
< const_iterator > 
const_reverse_iterator
 
typedef ptrdiff_t difference_type
 
typedef T * iterator
 
typedef T * pointer
 
typedef T & reference
 
typedef std::reverse_iterator
< iterator > 
reverse_iterator
 
typedef size_t size_type
 
typedef T Type
 
typedef T value_type
 

Public Member Functions

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

Protected Attributes

void * m_buffer
 
size_t m_capacity
 
size_t m_size
 

Detailed Description

template<typename T, typename Allocator = ByteAllocator>
class agx::VectorPOD< T, Allocator >

Vector containing 'raw' data.

Same interface as normal vectors, but no element constructors or destructors are executed. New elements are however initialized by basic memory copying from a default instance.

Definition at line 245 of file Vector.h.

Member Typedef Documentation

template<typename T, typename Allocator = ByteAllocator>
typedef const T* agx::VectorPOD< T, Allocator >::const_iterator

Definition at line 256 of file Vector.h.

template<typename T, typename Allocator = ByteAllocator>
typedef const T* agx::VectorPOD< T, Allocator >::const_pointer

Definition at line 251 of file Vector.h.

template<typename T, typename Allocator = ByteAllocator>
typedef const T& agx::VectorPOD< T, Allocator >::const_reference

Definition at line 253 of file Vector.h.

template<typename T, typename Allocator = ByteAllocator>
typedef std::reverse_iterator<const_iterator> agx::VectorPOD< T, Allocator >::const_reverse_iterator

Definition at line 323 of file Vector.h.

template<typename T, typename Allocator = ByteAllocator>
typedef ptrdiff_t agx::VectorPOD< T, Allocator >::difference_type

Definition at line 257 of file Vector.h.

template<typename T, typename Allocator = ByteAllocator>
typedef T* agx::VectorPOD< T, Allocator >::iterator

Definition at line 255 of file Vector.h.

template<typename T, typename Allocator = ByteAllocator>
typedef T* agx::VectorPOD< T, Allocator >::pointer

Definition at line 250 of file Vector.h.

template<typename T, typename Allocator = ByteAllocator>
typedef T& agx::VectorPOD< T, Allocator >::reference

Definition at line 252 of file Vector.h.

template<typename T, typename Allocator = ByteAllocator>
typedef std::reverse_iterator<iterator> agx::VectorPOD< T, Allocator >::reverse_iterator

Definition at line 322 of file Vector.h.

template<typename T, typename Allocator = ByteAllocator>
typedef size_t agx::VectorPOD< T, Allocator >::size_type

Definition at line 254 of file Vector.h.

template<typename T, typename Allocator = ByteAllocator>
typedef T agx::VectorPOD< T, Allocator >::Type

Definition at line 248 of file Vector.h.

template<typename T, typename Allocator = ByteAllocator>
typedef T agx::VectorPOD< T, Allocator >::value_type

Definition at line 249 of file Vector.h.

Member Enumeration Documentation

agxData::Values from this enumeration is passed to the subclasses' 'clear' method in order to control what should become of the container's memory.

Enumerator
SHRINK_BUFFER 

Buffer is deallocated and replaced by an newly allocated empty buffer.

SHRINK_BUFFER_AVERAGED 

Buffer is shrunk if a smoothing average (which is updated each clear call) goes below a threshold.

MAINTAIN_BUFFER 

Buffer is maintained (normal stl behavior).

Definition at line 42 of file Container.h.

Constructor & Destructor Documentation

template<typename T , typename A>
agx::VectorPOD< T, A >::VectorPOD ( const A &  allocator = Allocator())
explicit

Definition at line 1093 of file Vector.h.

References agx::ByteAllocator::setContainer().

template<typename T, typename A>
agx::VectorPOD< T, A >::VectorPOD ( size_t  size,
const T &  value = T(),
const A &  allocator = Allocator() 
)
explicit
template<typename T, typename A>
agx::VectorPOD< T, A >::VectorPOD ( const_iterator  first,
const_iterator  end,
const A &  allocator = Allocator() 
)
explicit
template<typename T, typename A>
agx::VectorPOD< T, A >::VectorPOD ( std::initializer_list< T >  values,
const A &  allocator = Allocator() 
)
template<typename T, typename A>
agx::VectorPOD< T, A >::VectorPOD ( const VectorPOD< T, A > &  other)

Definition at line 1107 of file Vector.h.

template<typename T, typename A>
agx::VectorPOD< T, A >::VectorPOD ( VectorPOD< T, A > &&  other)

Definition at line 1115 of file Vector.h.

References agx::ByteAllocator::setContainer().

template<typename T , typename A >
agx::VectorPOD< T, A >::~VectorPOD ( )

Definition at line 1317 of file Vector.h.

References agx::ByteAllocator::deallocateBytes(), m_capacity, and m_elements.

Member Function Documentation

template<typename T , typename A >
A & agx::VectorPOD< T, A >::allocator ( )

Definition at line 1593 of file Vector.h.

template<typename T , typename A >
const A & agx::VectorPOD< T, A >::allocator ( ) const

Definition at line 1596 of file Vector.h.

template<typename T , typename A >
T & agx::VectorPOD< T, A >::at ( size_t  index) const

Definition at line 1338 of file Vector.h.

References agxVerifyN, and m_elements.

template<typename T , typename A >
T & agx::VectorPOD< T, A >::back ( ) const

Definition at line 1354 of file Vector.h.

References agxAssert1, and m_elements.

Referenced by agxUtil::ConvexHull2D::back(), and agx::Event::trigger().

template<typename T , typename A >
VectorPOD< T, A >::iterator agx::VectorPOD< T, A >::begin ( )
template<typename T , typename A >
VectorPOD< T, A >::const_iterator agx::VectorPOD< T, A >::begin ( ) const

Definition at line 1615 of file Vector.h.

References m_elements.

size_t agx::Container::capacity ( ) const
inherited

Returns the size of the memory are used by the container to store its elements.

Some types of containers, e.g. the agx::Vector, will not do a reallocation until the size of the container reaches the capacity. However, this is not the case for e.g., agx::HashTable, which may perform a reallocation earlier.

Returns
The size of the allocated memory area, in number of elements.

Definition at line 135 of file Container.h.

References agx::Container::m_capacity.

Referenced by agx::Vector< T, Allocator >::operator=().

template<typename T , typename A >
void agx::VectorPOD< T, A >::clear ( ClearPolicy  policy = SHRINK_BUFFER_AVERAGED)
template<typename T , typename A >
template<typename T2 >
bool agx::VectorPOD< T, A >::contains ( const T2 &  element) const

Test if the vector contains a certain element.

Definition at line 1452 of file Vector.h.

References m_size.

Referenced by agx::Job::hasDependency().

template<typename T, typename A >
bool agx::VectorPOD< T, A >::contains ( const T &  element) const

Definition at line 1458 of file Vector.h.

References m_size.

template<typename T , typename A >
VectorPOD< T, A >::iterator agx::VectorPOD< T, A >::end ( )

Definition at line 1612 of file Vector.h.

References m_elements, and m_size.

Referenced by agxUtil::ConvexHull2D::end(), agx::end(), and agx::VectorPOD< T, Allocator >::VectorPOD().

template<typename T , typename A >
VectorPOD< T, A >::const_iterator agx::VectorPOD< T, A >::end ( ) const

Definition at line 1618 of file Vector.h.

References m_elements, and m_size.

template<typename T , typename A >
VectorPOD< T, A >::iterator agx::VectorPOD< T, A >::erase ( iterator  position)

STL erase functionality.

Definition at line 1395 of file Vector.h.

References agx::begin().

template<typename T , typename A >
VectorPOD< T, A >::iterator agx::VectorPOD< T, A >::erase ( iterator  start,
iterator  end 
)

Definition at line 1403 of file Vector.h.

References agx::begin().

template<typename T , typename A >
void agx::VectorPOD< T, A >::erase ( size_t  index)

Erase elements using indices instead of iterators.

Definition at line 1414 of file Vector.h.

template<typename T , typename A >
void agx::VectorPOD< T, A >::erase ( size_t  start,
size_t  end 
)

Definition at line 1420 of file Vector.h.

References agxAssert1, m_elements, and m_size.

template<typename T , typename A >
VectorPOD< T, A >::iterator agx::VectorPOD< T, A >::eraseFast ( const_iterator  position)

Fast erase, replacing the erased element with the last element.

Definition at line 1436 of file Vector.h.

References agx::begin().

template<typename T , typename A >
void agx::VectorPOD< T, A >::eraseFast ( size_t  index)

Definition at line 1444 of file Vector.h.

References agxAssertN, and m_elements.

template<typename T , typename A >
template<typename T2 >
size_t agx::VectorPOD< T, A >::find ( const T2 &  element) const

Find the index to a matching element, return size() if not found.

Definition at line 1465 of file Vector.h.

References m_elements, and m_size.

template<typename T, typename A >
bool agx::VectorPOD< T, A >::findAndErase ( const T &  element,
bool  searchMultiple = false 
)

Find and erase an element.

Parameters
element- Element to search for and erase
searchMultipleSet to true if search should continue after element is found, otherwise the search terminates on first match.
Returns
true if the element was found, else false

Definition at line 1478 of file Vector.h.

References m_elements, and m_size.

Referenced by agx::Job::removeDependency().

template<typename T , typename A >
T & agx::VectorPOD< T, A >::front ( ) const

Definition at line 1346 of file Vector.h.

References agxAssert1, and m_elements.

Referenced by agxUtil::ConvexHull2D::front().

template<typename T , typename A >
T * agx::VectorPOD< T, A >::increment ( size_t  numElements = 1)

Resize using a increment.

Definition at line 1255 of file Vector.h.

References AGX_VECTOR_RESIZE_FACTOR, m_capacity, and m_elements.

template<typename T, typename A >
VectorPOD< T, A >::iterator agx::VectorPOD< T, A >::insert ( iterator  position,
const T &  value 
)

Definition at line 1501 of file Vector.h.

References agxAssert, and agx::begin().

Referenced by agx::VectorPOD< T, Allocator >::VectorPOD().

template<typename T, typename A >
void agx::VectorPOD< T, A >::insert ( size_t  index,
const T &  value 
)
template<typename T , typename A >
template<typename InputIterator >
void agx::VectorPOD< T, A >::insert ( const_iterator  it,
InputIterator  first,
InputIterator  last 
)

Definition at line 1517 of file Vector.h.

References AGX_VECTOR_RESIZE_FACTOR, agx::begin(), m_capacity, and m_elements.

template<typename T, typename A >
void agx::VectorPOD< T, A >::insert ( const_iterator  it,
std::initializer_list< T >  ilist 
)

Definition at line 1511 of file Vector.h.

template<typename T, typename A>
bool agx::VectorPOD< T, A >::operator!= ( const VectorPOD< T, A > &  other) const

Definition at line 1282 of file Vector.h.

References m_elements, m_size, and agx::Container::size().

template<typename T, typename A>
VectorPOD< T, A > & agx::VectorPOD< T, A >::operator= ( const VectorPOD< T, A > &  other)
template<typename T, typename A>
bool agx::VectorPOD< T, A >::operator== ( const VectorPOD< T, A > &  other) const

Compare with other vector, return true if same size and all pairs are equal.

Definition at line 1269 of file Vector.h.

References m_elements, m_size, and agx::Container::size().

template<typename T , typename A >
T & agx::VectorPOD< T, A >::operator[] ( size_t  i) const

Definition at line 1330 of file Vector.h.

References agxAssertN, and m_elements.

template<typename T , typename A >
void agx::VectorPOD< T, A >::pop_back ( )

Definition at line 1386 of file Vector.h.

Referenced by agx::Event::trigger().

template<typename T , typename A >
T * agx::VectorPOD< T, A >::ptr ( )

Get access to the internal data buffer.

Definition at line 1324 of file Vector.h.

References m_elements.

Referenced by agxData::Array< T >::Array(), agxData::BufferT< T >::commit(), and agx::VectorPOD< T, Allocator >::operator=().

template<typename T , typename A >
const T * agx::VectorPOD< T, A >::ptr ( ) const

Definition at line 1327 of file Vector.h.

References m_elements.

template<typename T, typename A >
void agx::VectorPOD< T, A >::push_back ( T &&  value)
template<typename T , typename A >
VectorPOD< T, A >::reverse_iterator agx::VectorPOD< T, A >::rbegin ( )

Definition at line 1621 of file Vector.h.

References agx::end().

template<typename T , typename A >
VectorPOD< T, A >::const_reverse_iterator agx::VectorPOD< T, A >::rbegin ( ) const

Definition at line 1627 of file Vector.h.

References agx::end().

template<typename T , typename A >
VectorPOD< T, A >::reverse_iterator agx::VectorPOD< T, A >::rend ( )

Definition at line 1624 of file Vector.h.

References agx::begin().

template<typename T , typename A >
VectorPOD< T, A >::const_reverse_iterator agx::VectorPOD< T, A >::rend ( ) const

Definition at line 1630 of file Vector.h.

References agx::begin().

template<typename T , typename A >
void agx::VectorPOD< T, A >::reserve ( size_t  size)

Reserve capacity in the vector.

Definition at line 1235 of file Vector.h.

References m_capacity.

template<typename T , typename A >
void agx::VectorPOD< T, A >::reserveAtLeast ( size_t  size)

Reserve capacity in the vector.

Let vector grow in same way as push_back() does.

Definition at line 1243 of file Vector.h.

References AGX_VECTOR_MIN_SIZE, AGX_VECTOR_RESIZE_FACTOR, m_capacity, and agx::max().

template<typename T , typename A >
void agx::VectorPOD< T, A >::resize ( size_t  size)

Resize the vector, which then enables direct addressing using the bracket '[]' operator.

Definition at line 1196 of file Vector.h.

References AGX_VECTOR_SHRINK_THRESHOLD, and m_capacity.

Referenced by agx::VectorPOD< T, Allocator >::VectorPOD().

template<typename T, typename A >
void agx::VectorPOD< T, A >::resize ( size_t  size,
const T &  value 
)

Definition at line 1216 of file Vector.h.

References AGX_VECTOR_SHRINK_THRESHOLD, and m_capacity.

template<typename T , typename A >
void agx::VectorPOD< T, A >::shrink_to_fit ( )

Reduce the capacity of the vector to the actual size (number of elements)

Definition at line 1186 of file Vector.h.

References m_capacity.

size_t agx::Container::size ( ) const
inherited
Returns
The number of elements in the container.

Definition at line 134 of file Container.h.

References agx::Container::m_size.

Referenced by agxCollide::GroupFooCollider< ShapeType >::_calculateContacts(), agxData::Array< T >::Array(), agx::HashVector< agx::UInt32, agx::ref_ptr< RenderProxy > >::back(), agx::SetVector< const agxPowerLine::Unit * >::back(), agx::WireContactConstraint::calculateD(), agx::WireContactConstraint::calculateRHS(), agx::GlobalResult::Transaction::commit(), agxData::BufferT< T >::commit(), agxSDK::copyVectors(), agx::createMissingTiers(), agxCollide::Space::disableForContacts(), agxSDK::LinkedSegmentIterator< T >::end(), agx::ConstraintImplementation::findSecondaryConstraintGivenType(), agxSDK::MergeSplitThresholds::get(), agx::WireContactConstraint::getForceOnParticle(), agxSDK::MultiCollisionFilterContactHandler::getGeometryContact(), agxModel::HeightController::getHeight(), agx::WireContactConstraint::getInvMass(), agx::WireContactConstraint::getJacobian(), agx::WireContactConstraint::getMass(), agx::ConstraintImplementation::BodyView::getNumBodies(), agxSDK::LinkedStructure::getNumSegments(), agxIO::MeshReader::getNumTriangles(), agxSDK::MergeSplitThresholds::getNumValues(), agxSDK::LinkedStructure::getSegment(), agxSDK::CollisionGroupFilter::hasMemberGroup(), agxSDK::CollisionGroupFilter::match(), agx::Vector< T, Allocator >::operator!=(), agx::VectorPOD< T, Allocator >::operator!=(), agx::Vector< T, Allocator >::operator=(), agx::HashSetImplementation< CellPtr, HashFn< CellPtr >, ByteAllocator >::operator=(), agx::QuadraticProbingHashTableImplementation< SymmetricMaterialPair, agx::ContactMaterialRef, HashFn< SymmetricMaterialPair >, ByteAllocator >::operator=(), agx::VectorPOD< T, Allocator >::operator=(), agx::Vector< T, Allocator >::operator==(), agx::VectorPOD< T, Allocator >::operator==(), agx::HashVector< agx::UInt32, agx::ref_ptr< RenderProxy > >::operator[](), agx::SetVector< const agxPowerLine::Unit * >::operator[](), agxOSG::RenderStateManager::parseUniform(), agx::HashVector< agx::UInt32, agx::ref_ptr< RenderProxy > >::purge(), agx::SetVector< const agxPowerLine::Unit * >::purge(), agx::HashVector< agx::UInt32, agx::ref_ptr< RenderProxy > >::push_back(), agx::SetVector< const agxPowerLine::Unit * >::push_back(), agxIO::ArgumentParser::read1(), agxIO::ArgumentParser::read2(), agxIO::ArgumentParser::read3(), agx::HashSetImplementation< CellPtr, HashFn< CellPtr >, ByteAllocator >::rebuild(), agx::QuadraticProbingHashTableImplementation< SymmetricMaterialPair, agx::ContactMaterialRef, HashFn< SymmetricMaterialPair >, ByteAllocator >::rebuild(), agxRender::HeightFieldProxy::setHeights(), agxUtil::ConvexHull2D::size(), agx::HashVector< agx::UInt32, agx::ref_ptr< RenderProxy > >::size(), agx::SetVector< const agxPowerLine::Unit * >::size(), agxVehicle::utils::splitNonconsecutive(), agxWire::transformPointToShape(), agxWire::transformPointToWorld(), agxWire::transformVectorToShape(), agxWire::transformVectorToWorld(), agxModel::triangleIterator(), agx::Event::trigger(), and agxStream::StoreObjects< T >::~StoreObjects().

template<typename T , typename A >
void agx::VectorPOD< T, A >::swap ( VectorPOD< T, Allocator > &  other)

Definition at line 1660 of file Vector.h.

References agx::Container::m_buffer, agx::Container::m_capacity, m_capacity, and agx::Container::m_size.

Referenced by agx::swap().

Member Data Documentation


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