AGXDynamics  2.31.1.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
agx::HashSet< agx::ref_ptr< KeyT >, HashT, AllocatorT > Class Template Reference

#include <HashSet.h>

+ Inheritance diagram for agx::HashSet< agx::ref_ptr< KeyT >, HashT, AllocatorT >:

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
Implementation::const_iterator 
const_iterator
 
typedef const agx::ref_ptr
< KeyT > * 
const_pointer
 
typedef const agx::ref_ptr
< KeyT > & 
const_reference
 
typedef size_t difference_type
 
typedef HashSetImplementation
< agx::ref_ptr< KeyT >, HashT,
AllocatorT > 
Implementation
 
typedef Implementation::iterator iterator
 
typedef
std::bidirectional_iterator_tag 
iterator_category
 
typedef agx::ref_ptr< KeyT > * pointer
 
typedef agx::ref_ptr< KeyT > & reference
 
typedef size_t size_type
 
typedef agx::ref_ptr< KeyT > value_type
 

Public Member Functions

 HashSet (const AllocatorT &allocator=AllocatorT())
 
AllocatorT & allocator ()
 
const AllocatorT & allocator () const
 
iterator begin ()
 Iterator to first element in hash set. More...
 
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. More...
 
bool contains (const agx::ref_ptr< KeyT > &key) const
 Boolean query to test existence of an element. More...
 
bool contains (const KeyT *key) const
 
bool empty () const
 
iterator end ()
 Iterator marking end of hash set. More...
 
const_iterator end () const
 
bool erase (const agx::ref_ptr< KeyT > &key)
 Erase an element from the hash set. More...
 
iterator erase (const iterator &it)
 Erase an element using an iterator. More...
 
bool erase (const KeyT *key)
 
iterator find (const agx::ref_ptr< KeyT > &key)
 Find an element. More...
 
const_iterator find (const agx::ref_ptr< KeyT > &key) const
 
iterator find (const KeyT *key)
 
const_iterator find (const KeyT *key) const
 
insert_iterator insert (const agx::ref_ptr< KeyT > &key)
 Insert an element, overwriting if key already exists. More...
 
agx::ref_ptr< KeyT > & operator[] (const agx::ref_ptr< KeyT > &key)
 Index operator for accessing elements in the hash, inserting it if not found. More...
 
const agx::ref_ptr< KeyT > & operator[] (const agx::ref_ptr< KeyT > &key) const
 
void * ptr ()
 
const void * ptr () const
 
void purge (T purger)
 Purge the hash set. More...
 
void reserve (size_t size)
 Reserve capacity in the hash set. More...
 
size_t size () const
 

Protected Member Functions

Bucket * buckets () const
 
bool eraseBucket (size_t index)
 
size_t findBucket (const T2 &key) const
 
size_t & numBuckets ()
 
size_t numBuckets () const
 
size_t & numFilled ()
 
size_t numFilled () const
 
void rebuild (size_t size)
 Rebuild, and optionally resize hash set. More...
 

Protected Attributes

void * m_buffer
 
size_t m_capacity
 
size_t m_size
 

Detailed Description

template<typename KeyT, typename HashT, typename AllocatorT>
class agx::HashSet< agx::ref_ptr< KeyT >, HashT, AllocatorT >

Definition at line 675 of file HashSet.h.

Member Typedef Documentation

template<typename KeyT , typename HashT , typename AllocatorT >
typedef Implementation::const_iterator agx::HashSet< agx::ref_ptr< KeyT >, HashT, AllocatorT >::const_iterator

Definition at line 680 of file HashSet.h.

typedef const agx::ref_ptr< KeyT > * agx::HashSetImplementation< agx::ref_ptr< KeyT > , HashT, AllocatorT >::const_pointer
inherited

Definition at line 54 of file HashSet.h.

typedef const agx::ref_ptr< KeyT > & agx::HashSetImplementation< agx::ref_ptr< KeyT > , HashT, AllocatorT >::const_reference
inherited

Definition at line 56 of file HashSet.h.

typedef size_t agx::HashSetImplementation< agx::ref_ptr< KeyT > , HashT, AllocatorT >::difference_type
inherited

Definition at line 59 of file HashSet.h.

template<typename KeyT , typename HashT , typename AllocatorT >
typedef HashSetImplementation<agx::ref_ptr<KeyT>, HashT, AllocatorT> agx::HashSet< agx::ref_ptr< KeyT >, HashT, AllocatorT >::Implementation

Definition at line 678 of file HashSet.h.

template<typename KeyT , typename HashT , typename AllocatorT >
typedef Implementation::iterator agx::HashSet< agx::ref_ptr< KeyT >, HashT, AllocatorT >::iterator

Definition at line 679 of file HashSet.h.

typedef std::bidirectional_iterator_tag agx::HashSetImplementation< agx::ref_ptr< KeyT > , HashT, AllocatorT >::iterator_category
inherited

Definition at line 58 of file HashSet.h.

typedef agx::ref_ptr< KeyT > * agx::HashSetImplementation< agx::ref_ptr< KeyT > , HashT, AllocatorT >::pointer
inherited

Definition at line 53 of file HashSet.h.

typedef agx::ref_ptr< KeyT > & agx::HashSetImplementation< agx::ref_ptr< KeyT > , HashT, AllocatorT >::reference
inherited

Definition at line 55 of file HashSet.h.

typedef size_t agx::HashSetImplementation< agx::ref_ptr< KeyT > , HashT, AllocatorT >::size_type
inherited

Definition at line 57 of file HashSet.h.

typedef agx::ref_ptr< KeyT > agx::HashSetImplementation< agx::ref_ptr< KeyT > , HashT, AllocatorT >::value_type
inherited

Definition at line 52 of file HashSet.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 KeyT , typename HashT , typename AllocatorT >
agx::HashSet< agx::ref_ptr< KeyT >, HashT, AllocatorT >::HashSet ( const AllocatorT &  allocator = AllocatorT())
inline

Definition at line 682 of file HashSet.h.

Member Function Documentation

AllocatorT& agx::HashSetImplementation< agx::ref_ptr< KeyT > , HashT, AllocatorT >::allocator ( )
inlineinherited

Definition at line 484 of file HashSet.h.

const AllocatorT& agx::HashSetImplementation< agx::ref_ptr< KeyT > , HashT, AllocatorT >::allocator ( ) const
inlineinherited

Definition at line 485 of file HashSet.h.

iterator agx::HashSetImplementation< agx::ref_ptr< KeyT > , HashT, AllocatorT >::begin ( )
inlineinherited

Iterator to first element in hash set.

Definition at line 356 of file HashSet.h.

const_iterator agx::HashSetImplementation< agx::ref_ptr< KeyT > , HashT, AllocatorT >::begin ( ) const
inlineinherited

Definition at line 359 of file HashSet.h.

Bucket* agx::HashSetImplementation< agx::ref_ptr< KeyT > , HashT, AllocatorT >::buckets ( ) const
inlineprotectedinherited

Definition at line 523 of file HashSet.h.

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=().

void agx::HashSetImplementation< agx::ref_ptr< KeyT > , HashT, AllocatorT >::clear ( ClearPolicy  policy = SHRINK_BUFFER_AVERAGED)
inlineinherited

Remove all elements.

Definition at line 395 of file HashSet.h.

bool agx::HashSetImplementation< agx::ref_ptr< KeyT > , HashT, AllocatorT >::contains ( const agx::ref_ptr< KeyT > &  key) const
inlineinherited

Boolean query to test existence of an element.

Definition at line 310 of file HashSet.h.

template<typename KeyT , typename HashT , typename AllocatorT >
bool agx::HashSet< agx::ref_ptr< KeyT >, HashT, AllocatorT >::contains ( const KeyT *  key) const
inline
iterator agx::HashSetImplementation< agx::ref_ptr< KeyT > , HashT, AllocatorT >::end ( )
inlineinherited

Iterator marking end of hash set.

Definition at line 366 of file HashSet.h.

const_iterator agx::HashSetImplementation< agx::ref_ptr< KeyT > , HashT, AllocatorT >::end ( ) const
inlineinherited

Definition at line 369 of file HashSet.h.

bool agx::HashSetImplementation< agx::ref_ptr< KeyT > , HashT, AllocatorT >::erase ( const agx::ref_ptr< KeyT > &  key)
inlineinherited

Erase an element from the hash set.

Returns
false if element was not found

Definition at line 377 of file HashSet.h.

iterator agx::HashSetImplementation< agx::ref_ptr< KeyT > , HashT, AllocatorT >::erase ( const iterator &  it)
inlineinherited

Erase an element using an iterator.

Returns
An iterator to the next element

Definition at line 386 of file HashSet.h.

template<typename KeyT , typename HashT , typename AllocatorT >
bool agx::HashSet< agx::ref_ptr< KeyT >, HashT, AllocatorT >::erase ( const KeyT *  key)
inline
bool agx::HashSetImplementation< agx::ref_ptr< KeyT > , HashT, AllocatorT >::eraseBucket ( size_t  index)
inlineprotectedinherited

Definition at line 594 of file HashSet.h.

iterator agx::HashSetImplementation< agx::ref_ptr< KeyT > , HashT, AllocatorT >::find ( const agx::ref_ptr< KeyT > &  key)
inlineinherited

Find an element.

Definition at line 342 of file HashSet.h.

const_iterator agx::HashSetImplementation< agx::ref_ptr< KeyT > , HashT, AllocatorT >::find ( const agx::ref_ptr< KeyT > &  key) const
inlineinherited

Definition at line 347 of file HashSet.h.

template<typename KeyT , typename HashT , typename AllocatorT >
iterator agx::HashSet< agx::ref_ptr< KeyT >, HashT, AllocatorT >::find ( const KeyT *  key)
inline
template<typename KeyT , typename HashT , typename AllocatorT >
const_iterator agx::HashSet< agx::ref_ptr< KeyT >, HashT, AllocatorT >::find ( const KeyT *  key) const
inline
size_t agx::HashSetImplementation< agx::ref_ptr< KeyT > , HashT, AllocatorT >::findBucket ( const T2 &  key) const
inlineprotectedinherited

Definition at line 567 of file HashSet.h.

insert_iterator agx::HashSetImplementation< agx::ref_ptr< KeyT > , HashT, AllocatorT >::insert ( const agx::ref_ptr< KeyT > &  key)
inlineinherited

Insert an element, overwriting if key already exists.

Returns
An iterator to the inserted key

Definition at line 246 of file HashSet.h.

size_t& agx::HashSetImplementation< agx::ref_ptr< KeyT > , HashT, AllocatorT >::numBuckets ( )
inlineprotectedinherited

Definition at line 520 of file HashSet.h.

size_t agx::HashSetImplementation< agx::ref_ptr< KeyT > , HashT, AllocatorT >::numBuckets ( ) const
inlineprotectedinherited

Definition at line 524 of file HashSet.h.

size_t& agx::HashSetImplementation< agx::ref_ptr< KeyT > , HashT, AllocatorT >::numFilled ( )
inlineprotectedinherited

Definition at line 521 of file HashSet.h.

size_t agx::HashSetImplementation< agx::ref_ptr< KeyT > , HashT, AllocatorT >::numFilled ( ) const
inlineprotectedinherited

Definition at line 525 of file HashSet.h.

agx::ref_ptr< KeyT > & agx::HashSetImplementation< agx::ref_ptr< KeyT > , HashT, AllocatorT >::operator[] ( const agx::ref_ptr< KeyT > &  key)
inlineinherited

Index operator for accessing elements in the hash, inserting it if not found.

Parameters
key- The key to look for
Returns
reference to the matching data.

Definition at line 321 of file HashSet.h.

const agx::ref_ptr< KeyT > & agx::HashSetImplementation< agx::ref_ptr< KeyT > , HashT, AllocatorT >::operator[] ( const agx::ref_ptr< KeyT > &  key) const
inlineinherited

Definition at line 330 of file HashSet.h.

void * agx::Container::ptr ( )
inherited
Returns
Pointer to the container's memory area.

Definition at line 137 of file Container.h.

References agx::Container::m_buffer.

const void * agx::Container::ptr ( ) const
inherited

Definition at line 138 of file Container.h.

References agx::Container::m_buffer.

void agx::HashSetImplementation< agx::ref_ptr< KeyT > , HashT, AllocatorT >::purge ( T  purger)
inlineinherited

Purge the hash set.

Good to use when removing multiple items, since iterators are invalidated after any modification. The purger should be a functor class which takes the key as parameter and return true if the entry should be removed from the hash set.

Definition at line 466 of file HashSet.h.

void agx::HashSetImplementation< agx::ref_ptr< KeyT > , HashT, AllocatorT >::rebuild ( size_t  size)
inlineprotectedinherited

Rebuild, and optionally resize hash set.

Definition at line 530 of file HashSet.h.

void agx::HashSetImplementation< agx::ref_ptr< KeyT > , HashT, AllocatorT >::reserve ( size_t  size)
inlineinherited

Reserve capacity in the hash set.

Definition at line 451 of file HashSet.h.

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().

Member Data Documentation


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