|
MULTIBODY SIMULATION SOFTWARE - API documentation |
#include <CHhashTable.h>
Public Types | |
| typedef unsigned | size_type |
| typedef K | key_type |
| typedef T | data_type |
| typedef T | mapped_type |
|
typedef std::pair < const K, T > | value_type |
|
typedef ch_hash_iterator< K, T, H, E, value_type > | iterator |
|
typedef ch_hash_iterator< K, T, H, E, const value_type > | const_iterator |
Public Member Functions | |
| ChHashTable (unsigned bins=0) | |
| ChHashTable (const ChHashTable &) | |
| ChHashTable & | operator= (const ChHashTable &) |
| bool | empty (void) const |
| unsigned | size (void) const |
| bool | operator== (const ChHashTable &) const |
| bool | operator!= (const ChHashTable &) const |
| void | auto_rehash (void) |
| void | manual_rehash (void) |
| void | rehash (unsigned bins=0) |
| float | loading (void) const |
| bool | present (const K &key) const |
| size_type | count (const K &key) const |
| iterator | insert (const K &key, const T &data) |
| std::pair< iterator, bool > | insert (const value_type &value) |
| iterator | insert (const K &key) |
| bool | erase (const K &key) |
| void | erase (void) |
| void | clear (void) |
| const_iterator | find (const K &key) const |
| iterator | find (const K &key) |
| const T & | operator[] (const K &key) const |
| T & | operator[] (const K &key) |
| const_iterator | begin (void) const |
| iterator | begin (void) |
| const_iterator | end (void) const |
| iterator | end (void) |
Friends | |
| class | hash_element< K, T > |
| class | ch_hash_iterator< K, T, H, E, std::pair< const K, T > > |
| class | ch_hash_iterator< K, T, H, E, const std::pair< const K, T > > |
K = key type T = value type H = hash function object with the profile 'unsigned H(const K&)' E = equal function object with the profile 'bool E(const K&, const K&)' defaults to equal_to which in turn calls '=='
| chrono::ChHashTable< K, T, H, E >::ChHashTable | ( | unsigned | bins = 0 |
) |
Construct a ChHashTable table with specified number of bins. The default 0 bins means leave it to the table to decide. Specifying 0 bins also enables auto-rehashing, otherwise auto-rehashing defaults off
| chrono::ChHashTable< K, T, H, E >::ChHashTable | ( | const ChHashTable< K, T, H, E > & | right | ) |
Copy and equality copy the data elements but not the size of the copied table.
| bool chrono::ChHashTable< K, T, H, E >::empty | ( | void | ) | const |
Test for an empty table and for the size of a table Efficient because the size is stored separately from the table contents
| bool chrono::ChHashTable< K, T, H, E >::operator== | ( | const ChHashTable< K, T, H, E > & | right | ) | const |
Test for equality - two hashes are equal if they contain equal values.
| void chrono::ChHashTable< K, T, H, E >::auto_rehash | ( | void | ) |
Switch auto-rehash on.
| void chrono::ChHashTable< K, T, H, E >::manual_rehash | ( | void | ) |
Switch auto-rehash off.
| void chrono::ChHashTable< K, T, H, E >::rehash | ( | unsigned | bins = 0 |
) |
Force a rehash now Default of 0 means implement built-in size calculation for rehashing (recommended - it doubles the number of bins)
| float chrono::ChHashTable< K, T, H, E >::loading | ( | void | ) | const |
Test the loading ratio, which is the size divided by the number of bins. Use this if you are doing your own rehashing.
| bool chrono::ChHashTable< K, T, H, E >::present | ( | const K & | key | ) | const |
Test for the presence of a key.
| ChHashTable< K, T, H, E >::size_type chrono::ChHashTable< K, T, H, E >::count | ( | const K & | key | ) | const |
Provide map equivalent key count function (0 or 1, as not a multimap).
| ChHashTable< K, T, H, E >::iterator chrono::ChHashTable< K, T, H, E >::insert | ( | const K & | key, | |
| const T & | data | |||
| ) |
Insert a new key/data pair - replaces any previous value for this key.
| std::pair<iterator, bool> chrono::ChHashTable< K, T, H, E >::insert | ( | const value_type & | value | ) |
Insert a copy of the pair into the table (std::map compatible).
| ChHashTable< K, T, H, E >::iterator chrono::ChHashTable< K, T, H, E >::insert | ( | const K & | key | ) |
Insert a new key and return the iterator so that the data can be filled in.
| bool chrono::ChHashTable< K, T, H, E >::erase | ( | const K & | key | ) |
Remove a key/data pair from the hash table.
| void chrono::ChHashTable< K, T, H, E >::erase | ( | void | ) |
Remove all elements from the hash table.
| void chrono::ChHashTable< K, T, H, E >::clear | ( | void | ) |
Provide the std::map equivalent clear function.
| ChHashTable< K, T, H, E >::const_iterator chrono::ChHashTable< K, T, H, E >::find | ( | const K & | key | ) | const |
Find a key and return an iterator to it The iterator is like a pointer to a pair<const K,T> end() is returned if the find fails
| const T & chrono::ChHashTable< K, T, H, E >::operator[] | ( | const K & | key | ) | const |
Returns the data corresponding to the key the const version is used by the compiler on const hashes and cannot change the hash, so find failure causes an exception the non-const version is used by the compiler on non-const hashes and is like map - it creates a new key/data pair if find fails
| ChHashTable< K, T, H, E >::const_iterator chrono::ChHashTable< K, T, H, E >::begin | ( | void | ) | const |
Iterators allow the hash table to be traversed Iterators remain valid unless an item is removed or unless a rehash happens
CHRONO::ENGINE