|
AGX Dynamics 2.42.3.1
|
Same as hash table, but only containing keys, not key-value pairs. More...
#include <HashSet.h>
Inheritance diagram for agx::HashSetImplementation< KeyT, HashT, AllocatorT >:Classes | |
| class | Bucket |
| class | insert_iterator |
| class | template_iterator |
Public Types | |
| typedef template_iterator< const HashSetImplementation< KeyT, HashT, AllocatorT > > | const_iterator |
| typedef const KeyT * | const_pointer |
| typedef const KeyT & | const_reference |
| typedef size_t | difference_type |
| typedef template_iterator< HashSetImplementation< KeyT, HashT, AllocatorT > > | iterator |
| Iterators. | |
| typedef std::bidirectional_iterator_tag | iterator_category |
| typedef KeyT * | pointer |
| typedef KeyT & | reference |
| typedef size_t | size_type |
| typedef KeyT | 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... | |
Public Member Functions | |
| HashSetImplementation (const AllocatorT &allocator=AllocatorT()) | |
| Constructor. | |
| HashSetImplementation (const HashSetImplementation< KeyT, HashT, AllocatorT > &other) | |
| Copy constructor. | |
| ~HashSetImplementation () | |
| Destructor. | |
| AllocatorT & | allocator () |
| const AllocatorT & | allocator () const |
| iterator | begin () |
| Iterator to first element in hash set. | |
| const_iterator | begin () const |
| void | clear (ClearPolicy policy=SHRINK_BUFFER_AVERAGED) |
| Remove all elements. | |
| bool | contains (const KeyT &key) const |
| Boolean query to test existence of an element. | |
| iterator | end () |
| Iterator marking end of hash set. | |
| const_iterator | end () const |
| iterator | erase (const iterator &it) |
| Erase an element using an iterator. | |
| bool | erase (const KeyT &key) |
| Erase an element from the hash set. | |
| iterator | find (const KeyT &key) |
| Find an element. | |
| const_iterator | find (const KeyT &key) const |
| insert_iterator | insert (const KeyT &key) |
| Insert an element, overwriting if key already exists. | |
| HashSetImplementation< KeyT, HashT, AllocatorT > & | operator= (const HashSetImplementation< KeyT, HashT, AllocatorT > &other) |
| Assignment operator. | |
| KeyT & | operator[] (const KeyT &key) |
| Index operator for accessing elements in the hash, inserting it if not found. | |
| const KeyT & | operator[] (const KeyT &key) const |
| template<typename T > | |
| void | purge (T purger) |
| Purge the hash set. | |
| void | reserve (size_t size) |
| Reserve capacity in the hash set. | |
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 |
Protected Member Functions | |
| Bucket * | buckets () const |
| bool | eraseBucket (size_t index) |
| template<typename T2 > | |
| 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. | |
Protected Member Functions inherited from agx::Container | |
| Container () | |
| Container (const Container &other) | |
| Container (Container &&other) | |
| ~Container () | |
Additional Inherited Members | |
Protected Attributes inherited from agx::Container | |
| void * | m_buffer |
| size_t | m_capacity |
| size_t | m_size |
Same as hash table, but only containing keys, not key-value pairs.
Definition at line 49 of file agx/HashSet.h.
| typedef template_iterator< const HashSetImplementation<KeyT, HashT, AllocatorT> > agx::HashSetImplementation< KeyT, HashT, AllocatorT >::const_iterator |
Definition at line 178 of file agx/HashSet.h.
| typedef const KeyT* agx::HashSetImplementation< KeyT, HashT, AllocatorT >::const_pointer |
Definition at line 54 of file agx/HashSet.h.
| typedef const KeyT& agx::HashSetImplementation< KeyT, HashT, AllocatorT >::const_reference |
Definition at line 56 of file agx/HashSet.h.
| typedef size_t agx::HashSetImplementation< KeyT, HashT, AllocatorT >::difference_type |
Definition at line 59 of file agx/HashSet.h.
| typedef template_iterator< HashSetImplementation<KeyT, HashT, AllocatorT> > agx::HashSetImplementation< KeyT, HashT, AllocatorT >::iterator |
Iterators.
Definition at line 177 of file agx/HashSet.h.
| typedef std::bidirectional_iterator_tag agx::HashSetImplementation< KeyT, HashT, AllocatorT >::iterator_category |
Definition at line 58 of file agx/HashSet.h.
| typedef KeyT* agx::HashSetImplementation< KeyT, HashT, AllocatorT >::pointer |
Definition at line 53 of file agx/HashSet.h.
| typedef KeyT& agx::HashSetImplementation< KeyT, HashT, AllocatorT >::reference |
Definition at line 55 of file agx/HashSet.h.
| typedef size_t agx::HashSetImplementation< KeyT, HashT, AllocatorT >::size_type |
Definition at line 57 of file agx/HashSet.h.
| typedef KeyT agx::HashSetImplementation< KeyT, HashT, AllocatorT >::value_type |
Definition at line 52 of file agx/HashSet.h.
|
inline |
Constructor.
Definition at line 208 of file agx/HashSet.h.
|
inline |
Copy constructor.
Definition at line 212 of file agx/HashSet.h.
|
inline |
Destructor.
Definition at line 237 of file agx/HashSet.h.
References agx::HashSetImplementation< KeyT, HashT, AllocatorT >::buckets(), agx::Container::m_buffer, agx::Container::m_capacity, and agx::HashSetImplementation< KeyT, HashT, AllocatorT >::numBuckets().
|
inline |
Definition at line 488 of file agx/HashSet.h.
|
inline |
Definition at line 489 of file agx/HashSet.h.
|
inline |
Iterator to first element in hash set.
Definition at line 360 of file agx/HashSet.h.
Referenced by agx::HashSetImplementation< KeyT, HashT, AllocatorT >::operator=().
|
inline |
Definition at line 363 of file agx/HashSet.h.
|
inlineprotected |
Definition at line 527 of file agx/HashSet.h.
References agx::Container::m_buffer.
Referenced by agx::HashSetImplementation< KeyT, HashT, AllocatorT >::~HashSetImplementation(), agx::HashSetImplementation< KeyT, HashT, AllocatorT >::clear(), agx::HashSetImplementation< KeyT, HashT, AllocatorT >::eraseBucket(), agx::HashSetImplementation< KeyT, HashT, AllocatorT >::findBucket(), agx::HashSetImplementation< KeyT, HashT, AllocatorT >::insert(), agx::HashSetImplementation< KeyT, HashT, AllocatorT >::purge(), and agx::HashSetImplementation< KeyT, HashT, AllocatorT >::rebuild().
|
inline |
Remove all elements.
Definition at line 399 of file agx/HashSet.h.
References AGX_HASH_SET_MIN_SIZE, AGX_HASH_SET_SHRINK_THRESHOLD, AGX_HASH_SET_SMOOTHING_FACTOR, agx::HashSetImplementation< KeyT, HashT, AllocatorT >::buckets(), agx::Container::m_buffer, agx::Container::m_capacity, agx::Container::MAINTAIN_BUFFER, agx::nextPrime(), agx::HashSetImplementation< KeyT, HashT, AllocatorT >::numBuckets(), agx::HashSetImplementation< KeyT, HashT, AllocatorT >::numFilled(), and agx::Container::SHRINK_BUFFER.
Referenced by agx::HashSetImplementation< KeyT, HashT, AllocatorT >::operator=().
|
inline |
Boolean query to test existence of an element.
Definition at line 314 of file agx/HashSet.h.
References agx::HashSetImplementation< KeyT, HashT, AllocatorT >::findBucket(), and agx::HashSetImplementation< KeyT, HashT, AllocatorT >::numBuckets().
Referenced by agxCollide::CollisionGroupManager::canGroupsCollide(), agxCollide::CollisionGroupManager::canSetsCollide(), and agx::createMissingTiers().
|
inline |
Iterator marking end of hash set.
Definition at line 370 of file agx/HashSet.h.
References agx::HashSetImplementation< KeyT, HashT, AllocatorT >::numBuckets().
Referenced by agx::HashSetImplementation< KeyT, HashT, AllocatorT >::operator=(), and agx::HashSetImplementation< KeyT, HashT, AllocatorT >::operator[]().
|
inline |
Definition at line 373 of file agx/HashSet.h.
References agx::HashSetImplementation< KeyT, HashT, AllocatorT >::numBuckets().
|
inline |
Erase an element using an iterator.
Definition at line 390 of file agx/HashSet.h.
References agx::HashSetImplementation< KeyT, HashT, AllocatorT >::eraseBucket().
|
inline |
Erase an element from the hash set.
Definition at line 381 of file agx/HashSet.h.
References agx::HashSetImplementation< KeyT, HashT, AllocatorT >::eraseBucket(), and agx::HashSetImplementation< KeyT, HashT, AllocatorT >::findBucket().
|
inlineprotected |
Definition at line 598 of file agx/HashSet.h.
References agx::HashSetImplementation< KeyT, HashT, AllocatorT >::Bucket::ACTIVE, agx::HashSetImplementation< KeyT, HashT, AllocatorT >::buckets(), agx::HashSetImplementation< KeyT, HashT, AllocatorT >::Bucket::isValid(), agx::HashSetImplementation< KeyT, HashT, AllocatorT >::numBuckets(), agx::HashSetImplementation< KeyT, HashT, AllocatorT >::numFilled(), and agx::HashSetImplementation< KeyT, HashT, AllocatorT >::Bucket::state.
Referenced by agx::HashSetImplementation< KeyT, HashT, AllocatorT >::erase(), and agx::HashSet< agx::ref_ptr< KeyT >, HashT, AllocatorT >::erase().
|
inline |
Find an element.
Definition at line 346 of file agx/HashSet.h.
References agx::HashSetImplementation< KeyT, HashT, AllocatorT >::findBucket().
Referenced by agx::HashSetImplementation< KeyT, HashT, AllocatorT >::operator[]().
|
inline |
Definition at line 351 of file agx/HashSet.h.
References agx::HashSetImplementation< KeyT, HashT, AllocatorT >::findBucket().
|
inlineprotected |
Definition at line 571 of file agx/HashSet.h.
References agx::HashSetImplementation< KeyT, HashT, AllocatorT >::buckets(), agx::hashKeyEqual(), agx::HashSetImplementation< KeyT, HashT, AllocatorT >::Bucket::isActive(), agx::HashSetImplementation< KeyT, HashT, AllocatorT >::Bucket::isValid(), agx::HashSetImplementation< KeyT, HashT, AllocatorT >::Bucket::key, and agx::HashSetImplementation< KeyT, HashT, AllocatorT >::numBuckets().
Referenced by agx::HashSetImplementation< KeyT, HashT, AllocatorT >::contains(), agx::HashSet< agx::ref_ptr< KeyT >, HashT, AllocatorT >::contains(), agx::HashSetImplementation< KeyT, HashT, AllocatorT >::erase(), agx::HashSet< agx::ref_ptr< KeyT >, HashT, AllocatorT >::erase(), agx::HashSetImplementation< KeyT, HashT, AllocatorT >::find(), and agx::HashSet< agx::ref_ptr< KeyT >, HashT, AllocatorT >::find().
|
inline |
Insert an element, overwriting if key already exists.
Definition at line 250 of file agx/HashSet.h.
References AGX_HASH_SET_GROW_FACTOR, AGX_HASH_SET_GROW_THRESHOLD, AGX_HASH_SET_MAX_PROBE_LENGTH, agxAssert, agx::HashSetImplementation< KeyT, HashT, AllocatorT >::buckets(), agx::hashKeyEqual(), agx::HashSetImplementation< KeyT, HashT, AllocatorT >::insert(), agx::HashSetImplementation< KeyT, HashT, AllocatorT >::Bucket::isActive(), agx::HashSetImplementation< KeyT, HashT, AllocatorT >::Bucket::isValid(), agx::HashSetImplementation< KeyT, HashT, AllocatorT >::Bucket::key, agx::HashSetImplementation< KeyT, HashT, AllocatorT >::numBuckets(), agx::HashSetImplementation< KeyT, HashT, AllocatorT >::numFilled(), agx::HashSetImplementation< KeyT, HashT, AllocatorT >::rebuild(), agx::HashSetImplementation< KeyT, HashT, AllocatorT >::Bucket::state, and agx::HashSetImplementation< KeyT, HashT, AllocatorT >::Bucket::VALID.
Referenced by agx::createMissingTiers(), agx::HashSetImplementation< KeyT, HashT, AllocatorT >::insert(), agx::HashSetImplementation< KeyT, HashT, AllocatorT >::operator=(), agx::HashSetImplementation< KeyT, HashT, AllocatorT >::operator[](), and agx::HashSetImplementation< KeyT, HashT, AllocatorT >::rebuild().
|
inlineprotected |
Definition at line 524 of file agx/HashSet.h.
References agx::Container::m_capacity.
Referenced by agx::HashSetImplementation< KeyT, HashT, AllocatorT >::~HashSetImplementation(), agx::HashSetImplementation< KeyT, HashT, AllocatorT >::clear(), agx::HashSetImplementation< KeyT, HashT, AllocatorT >::contains(), agx::HashSet< agx::ref_ptr< KeyT >, HashT, AllocatorT >::contains(), agx::HashSetImplementation< KeyT, HashT, AllocatorT >::end(), agx::HashSetImplementation< KeyT, HashT, AllocatorT >::eraseBucket(), agx::HashSetImplementation< KeyT, HashT, AllocatorT >::findBucket(), agx::HashSetImplementation< KeyT, HashT, AllocatorT >::insert(), agx::HashSetImplementation< KeyT, HashT, AllocatorT >::purge(), agx::HashSetImplementation< KeyT, HashT, AllocatorT >::rebuild(), and agx::HashSetImplementation< KeyT, HashT, AllocatorT >::reserve().
|
inlineprotected |
Definition at line 528 of file agx/HashSet.h.
References agx::Container::m_capacity.
|
inlineprotected |
Definition at line 525 of file agx/HashSet.h.
References agx::Container::m_size.
Referenced by agx::HashSetImplementation< KeyT, HashT, AllocatorT >::clear(), agx::HashSetImplementation< KeyT, HashT, AllocatorT >::eraseBucket(), agx::HashSetImplementation< KeyT, HashT, AllocatorT >::insert(), agx::HashSetImplementation< KeyT, HashT, AllocatorT >::purge(), and agx::HashSetImplementation< KeyT, HashT, AllocatorT >::rebuild().
|
inlineprotected |
Definition at line 529 of file agx/HashSet.h.
References agx::Container::m_size.
|
inline |
Assignment operator.
Definition at line 218 of file agx/HashSet.h.
References agx::HashSetImplementation< KeyT, HashT, AllocatorT >::begin(), agx::HashSetImplementation< KeyT, HashT, AllocatorT >::clear(), agx::HashSetImplementation< KeyT, HashT, AllocatorT >::end(), agx::HashSetImplementation< KeyT, HashT, AllocatorT >::insert(), agx::Container::MAINTAIN_BUFFER, agx::HashSetImplementation< KeyT, HashT, AllocatorT >::reserve(), and agx::Container::size().
|
inline |
Index operator for accessing elements in the hash, inserting it if not found.
| key | - The key to look for |
Definition at line 325 of file agx/HashSet.h.
References agx::HashSetImplementation< KeyT, HashT, AllocatorT >::end(), agx::HashSetImplementation< KeyT, HashT, AllocatorT >::find(), and agx::HashSetImplementation< KeyT, HashT, AllocatorT >::insert().
|
inline |
Definition at line 334 of file agx/HashSet.h.
References agx::HashSetImplementation< KeyT, HashT, AllocatorT >::end(), agx::HashSetImplementation< KeyT, HashT, AllocatorT >::find(), and agx::HashSetImplementation< KeyT, HashT, AllocatorT >::insert().
|
inline |
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 470 of file agx/HashSet.h.
References agx::HashSetImplementation< KeyT, HashT, AllocatorT >::Bucket::ACTIVE, AGX_HASH_SET_GROW_FACTOR, AGX_HASH_SET_MIN_SIZE, AGX_HASH_SET_SHRINK_FACTOR, AGX_HASH_SET_SHRINK_THRESHOLD, agx::HashSetImplementation< KeyT, HashT, AllocatorT >::buckets(), agx::HashSetImplementation< KeyT, HashT, AllocatorT >::Bucket::isValid(), agx::HashSetImplementation< KeyT, HashT, AllocatorT >::Bucket::key, agx::HashSetImplementation< KeyT, HashT, AllocatorT >::numBuckets(), agx::HashSetImplementation< KeyT, HashT, AllocatorT >::numFilled(), agx::HashSetImplementation< KeyT, HashT, AllocatorT >::rebuild(), and agx::HashSetImplementation< KeyT, HashT, AllocatorT >::Bucket::state.
|
inlineprotected |
Rebuild, and optionally resize hash set.
Definition at line 534 of file agx/HashSet.h.
References AGX_HASH_SET_MIN_SIZE, agxAssert, agx::HashSetImplementation< KeyT, HashT, AllocatorT >::buckets(), agx::HashSetImplementation< KeyT, HashT, AllocatorT >::insert(), agx::HashSetImplementation< KeyT, HashT, AllocatorT >::Bucket::isValid(), agx::HashSetImplementation< KeyT, HashT, AllocatorT >::Bucket::key, agx::Container::m_buffer, agx::nextPrime(), agx::HashSetImplementation< KeyT, HashT, AllocatorT >::numBuckets(), agx::HashSetImplementation< KeyT, HashT, AllocatorT >::numFilled(), and agx::Container::size().
Referenced by agx::HashSetImplementation< KeyT, HashT, AllocatorT >::insert(), agx::HashSetImplementation< KeyT, HashT, AllocatorT >::purge(), and agx::HashSetImplementation< KeyT, HashT, AllocatorT >::reserve().
|
inline |
Reserve capacity in the hash set.
Definition at line 455 of file agx/HashSet.h.
References AGX_HASH_SET_GROW_THRESHOLD, agx::HashSetImplementation< KeyT, HashT, AllocatorT >::numBuckets(), agx::HashSetImplementation< KeyT, HashT, AllocatorT >::rebuild(), and agx::Container::size().
Referenced by agxPowerLine::DotGraphWriter::SeenSubGraph::SeenSubGraph(), and agx::HashSetImplementation< KeyT, HashT, AllocatorT >::operator=().