AGXDynamics  2.31.1.0
agx::QuadraticProbingHashTable< agx::ref_ptr< KeyT >, DataT, HashT, AllocatorT > Class Template Reference

#include <QuadraticProbingHashTable.h>

+ Inheritance diagram for agx::QuadraticProbingHashTable< agx::ref_ptr< KeyT >, DataT, 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 HashT hash_fn_type
 
typedef QuadraticProbingHashTableImplementation< agx::ref_ptr< KeyT >, DataT, HashT, AllocatorT > Implementation
 
typedef Implementation::iterator iterator
 
typedef agx::ref_ptr< KeyT > key_type
 
typedef DataT value_type
 

Public Member Functions

 QuadraticProbingHashTable (const AllocatorT &allocator=AllocatorT())
 
AllocatorT & allocator ()
 
const AllocatorT & allocator () const
 
iterator begin ()
 Iterator to first element in hash table. 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 table. More...
 
const_iterator end () const
 
bool erase (const agx::ref_ptr< KeyT > &key)
 Erase an element from the hash table. 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
 
const Bucket * getBucketBuffer () const
 
size_t getMaxProbeLength () const
 
size_t getNumBuckets () const
 
DataT & getOrCreate (const agx::ref_ptr< KeyT > &key)
 Returns value given key. More...
 
insert_iterator insert (const agx::ref_ptr< KeyT > &key, const DataT &data)
 Insert an element, overwriting if key already exists. More...
 
DataT & operator[] (const agx::ref_ptr< KeyT > &key)
 Index operator for accessing elements in the hash, inserting it if not found. More...
 
const DataT & operator[] (const agx::ref_ptr< KeyT > &key) const
 
void * ptr ()
 
const void * ptr () const
 
void purge (T purger)
 Purge the hash table. More...
 
void reserve (size_t size)
 Reserve capacity in the hash table. 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 table. More...
 

Protected Attributes

void * m_buffer
 
size_t m_capacity
 
size_t m_size
 

Detailed Description

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

Definition at line 709 of file QuadraticProbingHashTable.h.

Member Typedef Documentation

◆ const_iterator

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

Definition at line 714 of file QuadraticProbingHashTable.h.

◆ hash_fn_type

typedef HashT agx::QuadraticProbingHashTableImplementation< agx::ref_ptr< KeyT > , DataT, HashT, AllocatorT >::hash_fn_type
inherited

Definition at line 52 of file QuadraticProbingHashTable.h.

◆ Implementation

template<typename KeyT , typename DataT , typename HashT , typename AllocatorT >
typedef QuadraticProbingHashTableImplementation<agx::ref_ptr<KeyT>, DataT, HashT, AllocatorT> agx::QuadraticProbingHashTable< agx::ref_ptr< KeyT >, DataT, HashT, AllocatorT >::Implementation

Definition at line 712 of file QuadraticProbingHashTable.h.

◆ iterator

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

Definition at line 713 of file QuadraticProbingHashTable.h.

◆ key_type

typedef agx::ref_ptr< KeyT > agx::QuadraticProbingHashTableImplementation< agx::ref_ptr< KeyT > , DataT, HashT, AllocatorT >::key_type
inherited

Definition at line 51 of file QuadraticProbingHashTable.h.

◆ value_type

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

Definition at line 50 of file QuadraticProbingHashTable.h.

Member Enumeration Documentation

◆ ClearPolicy

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

◆ QuadraticProbingHashTable()

template<typename KeyT , typename DataT , typename HashT , typename AllocatorT >
agx::QuadraticProbingHashTable< agx::ref_ptr< KeyT >, DataT, HashT, AllocatorT >::QuadraticProbingHashTable ( const AllocatorT &  allocator = AllocatorT())
inline

Definition at line 716 of file QuadraticProbingHashTable.h.

Member Function Documentation

◆ allocator() [1/2]

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

Definition at line 565 of file QuadraticProbingHashTable.h.

◆ allocator() [2/2]

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

Definition at line 566 of file QuadraticProbingHashTable.h.

◆ begin() [1/2]

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

Iterator to first element in hash table.

Definition at line 419 of file QuadraticProbingHashTable.h.

◆ begin() [2/2]

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

Definition at line 422 of file QuadraticProbingHashTable.h.

◆ buckets()

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

Definition at line 586 of file QuadraticProbingHashTable.h.

◆ capacity()

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

◆ clear()

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

Remove all elements.

Definition at line 458 of file QuadraticProbingHashTable.h.

◆ contains() [1/2]

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

Boolean query to test existence of an element.

Definition at line 397 of file QuadraticProbingHashTable.h.

◆ contains() [2/2]

template<typename KeyT , typename DataT , typename HashT , typename AllocatorT >
bool agx::QuadraticProbingHashTable< agx::ref_ptr< KeyT >, DataT, HashT, AllocatorT >::contains ( const KeyT *  key) const
inline

◆ empty()

bool agx::Container::empty ( ) const
inherited

◆ end() [1/2]

iterator agx::QuadraticProbingHashTableImplementation< agx::ref_ptr< KeyT > , DataT, HashT, AllocatorT >::end ( )
inlineinherited

Iterator marking end of hash table.

Definition at line 429 of file QuadraticProbingHashTable.h.

◆ end() [2/2]

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

Definition at line 432 of file QuadraticProbingHashTable.h.

◆ erase() [1/3]

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

Erase an element from the hash table.

Returns
false if element was not found

Definition at line 440 of file QuadraticProbingHashTable.h.

◆ erase() [2/3]

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

Erase an element using an iterator.

Returns
An iterator to the next element

Definition at line 449 of file QuadraticProbingHashTable.h.

◆ erase() [3/3]

template<typename KeyT , typename DataT , typename HashT , typename AllocatorT >
bool agx::QuadraticProbingHashTable< agx::ref_ptr< KeyT >, DataT, HashT, AllocatorT >::erase ( const KeyT *  key)
inline

◆ eraseBucket()

bool agx::QuadraticProbingHashTableImplementation< agx::ref_ptr< KeyT > , DataT, HashT, AllocatorT >::eraseBucket ( size_t  index)
inlineprotectedinherited

Definition at line 659 of file QuadraticProbingHashTable.h.

◆ find() [1/4]

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

Find an element.

Definition at line 405 of file QuadraticProbingHashTable.h.

◆ find() [2/4]

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

Definition at line 410 of file QuadraticProbingHashTable.h.

◆ find() [3/4]

template<typename KeyT , typename DataT , typename HashT , typename AllocatorT >
iterator agx::QuadraticProbingHashTable< agx::ref_ptr< KeyT >, DataT, HashT, AllocatorT >::find ( const KeyT *  key)
inline

◆ find() [4/4]

template<typename KeyT , typename DataT , typename HashT , typename AllocatorT >
const_iterator agx::QuadraticProbingHashTable< agx::ref_ptr< KeyT >, DataT, HashT, AllocatorT >::find ( const KeyT *  key) const
inline

◆ findBucket()

size_t agx::QuadraticProbingHashTableImplementation< agx::ref_ptr< KeyT > , DataT, HashT, AllocatorT >::findBucket ( const T2 &  key) const
inlineprotectedinherited

Definition at line 632 of file QuadraticProbingHashTable.h.

◆ getBucketBuffer()

const Bucket* agx::QuadraticProbingHashTableImplementation< agx::ref_ptr< KeyT > , DataT, HashT, AllocatorT >::getBucketBuffer ( ) const
inlineinherited

Definition at line 573 of file QuadraticProbingHashTable.h.

◆ getMaxProbeLength()

size_t agx::QuadraticProbingHashTableImplementation< agx::ref_ptr< KeyT > , DataT, HashT, AllocatorT >::getMaxProbeLength ( ) const
inlineinherited

Definition at line 574 of file QuadraticProbingHashTable.h.

◆ getNumBuckets()

size_t agx::QuadraticProbingHashTableImplementation< agx::ref_ptr< KeyT > , DataT, HashT, AllocatorT >::getNumBuckets ( ) const
inlineinherited

Definition at line 575 of file QuadraticProbingHashTable.h.

◆ getOrCreate()

DataT& agx::QuadraticProbingHashTableImplementation< agx::ref_ptr< KeyT > , DataT, HashT, AllocatorT >::getOrCreate ( const agx::ref_ptr< KeyT > &  key)
inlineinherited

Returns value given key.

If the key doesn't exist, the key is inserted and the default value is returned.

Parameters
key- key
Returns
data for key

Definition at line 321 of file QuadraticProbingHashTable.h.

◆ insert()

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

Insert an element, overwriting if key already exists.

Returns
An iterator to the inserted pair

Definition at line 330 of file QuadraticProbingHashTable.h.

◆ numBuckets() [1/2]

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

Definition at line 583 of file QuadraticProbingHashTable.h.

◆ numBuckets() [2/2]

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

Definition at line 587 of file QuadraticProbingHashTable.h.

◆ numFilled() [1/2]

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

Definition at line 584 of file QuadraticProbingHashTable.h.

◆ numFilled() [2/2]

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

Definition at line 588 of file QuadraticProbingHashTable.h.

◆ operator[]() [1/2]

DataT& agx::QuadraticProbingHashTableImplementation< agx::ref_ptr< KeyT > , DataT, 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 299 of file QuadraticProbingHashTable.h.

◆ operator[]() [2/2]

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

Definition at line 308 of file QuadraticProbingHashTable.h.

◆ ptr() [1/2]

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.

◆ ptr() [2/2]

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

Definition at line 138 of file Container.h.

References agx::Container::m_buffer.

◆ purge()

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

Purge the hash table.

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 and value as parameters and return true if the pair should be removed from the hash table.

Definition at line 543 of file QuadraticProbingHashTable.h.

◆ rebuild()

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

Rebuild, and optionally resize hash table.

Definition at line 594 of file QuadraticProbingHashTable.h.

◆ reserve()

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

Reserve capacity in the hash table.

Definition at line 528 of file QuadraticProbingHashTable.h.

◆ size()

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< JacobianElementT >::Array(), agx::HashVector< agx::UInt32, agx::ref_ptr< RenderProxy > >::back(), agx::SetVector< agx::ref_ptr< agxSDK::EventListener > >::back(), agx::MemoryPoolOld< T >::clear(), agxData::BufferT< T >::commit(), agxSDK::copyVectors(), agx::createMissingTiers(), agxCollide::Space::disableForContacts(), agxSDK::LinkedSegmentIterator< T >::end(), agxSDK::LinkedSegmentIterator< T >::findPrevIndex(), agx::ConstraintImplementation::findSecondaryConstraintGivenType(), agx::MemoryPoolOld< T >::garbageCollect(), agx::ConstraintImplementation::BodyView::getNumBodies(), agx::ConstraintImplementation::SolverBodyView::getPermutedBodyAt(), agxSDK::LinkedSegmentIterator< T >::isEnd(), agxPowerLine::ConnectionIterator< T >::isValid(), agxPowerLine::PhysicalDimensionIterator< UnitPtr >::isValid(), agx::Vector< WireContactConstraintRef >::operator!=(), agx::VectorPOD< agx::Vec6 >::operator!=(), agxSDK::LinkedSegmentIterator< T >::operator+(), agxPowerLine::PhysicalDimensionIterator< UnitPtr >::operator++(), agxSDK::LinkedSegmentIterator< T >::operator-(), agx::Vector< WireContactConstraintRef >::operator=(), agx::HashSetImplementation< CellPtr, HashFn< CellPtr >, ByteAllocator >::operator=(), agx::QuadraticProbingHashTableImplementation< SymmetricMaterialPair, agx::ContactMaterialRef, HashFn< SymmetricMaterialPair >, ByteAllocator >::operator=(), agx::VectorPOD< agx::Vec6 >::operator=(), agx::Vector< WireContactConstraintRef >::operator==(), agx::VectorPOD< agx::Vec6 >::operator==(), agx::HashVector< agx::UInt32, agx::ref_ptr< RenderProxy > >::operator[](), agx::SetVector< agx::ref_ptr< agxSDK::EventListener > >::operator[](), agxOSG::RenderStateManager::parseUniform(), agx::HashVector< agx::UInt32, agx::ref_ptr< RenderProxy > >::purge(), agx::SetVector< agx::ref_ptr< agxSDK::EventListener > >::purge(), agx::HashVector< agx::UInt32, agx::ref_ptr< RenderProxy > >::push_back(), agx::SetVector< agx::ref_ptr< agxSDK::EventListener > >::push_back(), agx::HashSetImplementation< CellPtr, HashFn< CellPtr >, ByteAllocator >::rebuild(), agx::QuadraticProbingHashTableImplementation< SymmetricMaterialPair, agx::ContactMaterialRef, HashFn< SymmetricMaterialPair >, ByteAllocator >::rebuild(), agxRender::HeightFieldProxy::setHeights(), agx::HashVector< agx::UInt32, agx::ref_ptr< RenderProxy > >::size(), agx::SetVector< agx::ref_ptr< agxSDK::EventListener > >::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

◆ m_buffer

◆ m_capacity

◆ m_size


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