Hashing based table. More...
#include <table.hh>
Public Types | |
typedef const_iter< Key, Value, Extract, Hash, Equal > | const_iterator |
const iterator type | |
typedef iter< Key, Value, Extract, Hash, Equal > | iterator |
iterator type | |
typedef arg_traits< key_type > ::type | key_arg |
typedef Key | key_type |
Key type. | |
typedef size_t | size_type |
Size type. | |
typedef arg_traits< value_type > ::type | value_arg |
typedef Value | value_type |
Value type for cells. | |
Public Member Functions | |
iterator | begin () |
Beginning of table. | |
const_iterator | begin () const |
Beginning of table. | |
void | clear () |
remove all elements | |
bool | empty () const |
Emptyness test. | |
iterator | end () |
End of table. | |
const_iterator | end () const |
End of table. | |
std::pair< iterator, iterator > | equal_range (key_arg key) |
equality range | |
std::pair< const_iterator, const_iterator > | equal_range (key_arg key) const |
equality range. | |
void | erase (iterator const &first, iterator const &last) |
Remove elements. | |
iterator | insert_multiple (value_arg v) |
multiple insertion | |
std::pair< iterator, bool > | insert_unique (value_arg v) |
Unique key insertion. | |
size_type | max_size () const |
max elmement number | |
table & | operator= (table const &other) |
Copy operator. | |
size_type | size () const |
element count | |
void | swap (table &other) |
swapping values function | |
table () | |
Default constructor. | |
table (table const &) | |
Copy constructor. | |
~table () | |
Copy destructor. | |
Private Types | |
typedef std::vector< node_type * > | bucket_type |
typedef node< value_type > | node_type |
Private Member Functions | |
node_type ** | find_node (key_arg k) |
node_type * | find_node (key_arg k) const |
size_t | hash_node (value_arg v) |
node_type * | insert (node_type **helper, value_arg v) |
void | resize (size_type size) |
Static Private Member Functions | |
static bucket_type | copy_bucket (bucket_type const &other) |
static key_type const & | get_key (value_arg v) |
static size_t | hash_key (key_arg k, size_type mod) |
static size_t | hash_node (value_arg v, size_type mod) |
Private Attributes | |
size_type | avg_bucket_count |
bucket_type | bucket |
size_type | node_count |
Friends | |
class | const_iter |
class | iter |
Hashing based table.
This class is used as internal basis for all hashing based containers presented here. It is mainly insdpired on SGI STL implementation
Key | the entry type for this table |
Value | The value type for cells in table |
Extract | Key extractor from Value |
Hash | hashing functor for Key |
Equal | equality functor for Key |
typedef std::vector<node_type *> utilmm::hash_toolbox::table< Key, Value, Extract, Hash, Equal >::bucket_type [private] |
typedef const_iter<Key, Value, Extract, Hash, Equal> utilmm::hash_toolbox::table< Key, Value, Extract, Hash, Equal >::const_iterator |
typedef iter<Key, Value, Extract, Hash, Equal> utilmm::hash_toolbox::table< Key, Value, Extract, Hash, Equal >::iterator |
typedef arg_traits<key_type>::type utilmm::hash_toolbox::table< Key, Value, Extract, Hash, Equal >::key_arg |
typedef Key utilmm::hash_toolbox::table< Key, Value, Extract, Hash, Equal >::key_type |
typedef node<value_type> utilmm::hash_toolbox::table< Key, Value, Extract, Hash, Equal >::node_type [private] |
typedef size_t utilmm::hash_toolbox::table< Key, Value, Extract, Hash, Equal >::size_type |
typedef arg_traits<value_type>::type utilmm::hash_toolbox::table< Key, Value, Extract, Hash, Equal >::value_arg |
typedef Value utilmm::hash_toolbox::table< Key, Value, Extract, Hash, Equal >::value_type |
utilmm::hash_toolbox::table< Key, Value, Extract, Hash, Equal >::table | ( | ) |
Default constructor.
Create an empty table
utilmm::hash_toolbox::table< Key, Value, Extract, Hash, Equal >::table | ( | table< Key, Value, Extract, Hash, Equal > const & | ) |
Copy constructor.
utilmm::hash_toolbox::table< Key, Value, Extract, Hash, Equal >::~table | ( | ) |
Copy destructor.
iterator utilmm::hash_toolbox::table< Key, Value, Extract, Hash, Equal >::begin | ( | ) |
const_iterator utilmm::hash_toolbox::table< Key, Value, Extract, Hash, Equal >::begin | ( | ) | const |
Beginning of table.
void utilmm::hash_toolbox::table< Key, Value, Extract, Hash, Equal >::clear | ( | ) |
static bucket_type utilmm::hash_toolbox::table< Key, Value, Extract, Hash, Equal >::copy_bucket | ( | bucket_type const & | other | ) | [static, private] |
bool utilmm::hash_toolbox::table< Key, Value, Extract, Hash, Equal >::empty | ( | ) | const |
iterator utilmm::hash_toolbox::table< Key, Value, Extract, Hash, Equal >::end | ( | ) |
const_iterator utilmm::hash_toolbox::table< Key, Value, Extract, Hash, Equal >::end | ( | ) | const |
std::pair<iterator, iterator> utilmm::hash_toolbox::table< Key, Value, Extract, Hash, Equal >::equal_range | ( | key_arg | key | ) |
equality range
key | a Key |
This function tries to fuind all the elements of this table with a key equal to key
std::pair< const_iterator, const_iterator > utilmm::hash_toolbox::table< Key, Value, Extract, Hash, Equal >::equal_range | ( | key_arg | key | ) | const |
equality range.
equality range
key | a Key |
This function tries to fuind all the elements of this table with a key equal to key
void utilmm::hash_toolbox::table< Key, Value, Extract, Hash, Equal >::erase | ( | iterator const & | first, |
iterator const & | last | ||
) |
Remove elements.
first | an iterator |
last | an iterator |
removes all the element of the table in the range [first, last [
node_type** utilmm::hash_toolbox::table< Key, Value, Extract, Hash, Equal >::find_node | ( | key_arg | k | ) | [private] |
node_type* utilmm::hash_toolbox::table< Key, Value, Extract, Hash, Equal >::find_node | ( | key_arg | k | ) | const [private] |
static key_type const& utilmm::hash_toolbox::table< Key, Value, Extract, Hash, Equal >::get_key | ( | value_arg | v | ) | [static, private] |
static size_t utilmm::hash_toolbox::table< Key, Value, Extract, Hash, Equal >::hash_key | ( | key_arg | k, |
size_type | mod | ||
) | [static, private] |
static size_t utilmm::hash_toolbox::table< Key, Value, Extract, Hash, Equal >::hash_node | ( | value_arg | v, |
size_type | mod | ||
) | [static, private] |
size_t utilmm::hash_toolbox::table< Key, Value, Extract, Hash, Equal >::hash_node | ( | value_arg | v | ) | [private] |
node_type* utilmm::hash_toolbox::table< Key, Value, Extract, Hash, Equal >::insert | ( | node_type ** | helper, |
value_arg | v | ||
) | [private] |
iterator utilmm::hash_toolbox::table< Key, Value, Extract, Hash, Equal >::insert_multiple | ( | value_arg | v | ) |
multiple insertion
param v The value to insert
Thsi function insert v in table
std::pair<iterator, bool> utilmm::hash_toolbox::table< Key, Value, Extract, Hash, Equal >::insert_unique | ( | value_arg | v | ) |
Unique key insertion.
v | The value to insert |
This function tries to insert v in the table except if there's already an element whose keys is equal to the key of v
first
is an iterator pointing to the element whose key is equal to the key of v and second
is true if we have inserted v size_type utilmm::hash_toolbox::table< Key, Value, Extract, Hash, Equal >::max_size | ( | ) | const |
max elmement number
table& utilmm::hash_toolbox::table< Key, Value, Extract, Hash, Equal >::operator= | ( | table< Key, Value, Extract, Hash, Equal > const & | other | ) |
Copy operator.
void utilmm::hash_toolbox::table< Key, Value, Extract, Hash, Equal >::resize | ( | size_type | size | ) | [private] |
size_type utilmm::hash_toolbox::table< Key, Value, Extract, Hash, Equal >::size | ( | ) | const |
element count
void utilmm::hash_toolbox::table< Key, Value, Extract, Hash, Equal >::swap | ( | table< Key, Value, Extract, Hash, Equal > & | other | ) |
swapping values function
This function exchange the value of current instance with the value of another instance.
other | The other instance |
friend class const_iter [friend] |
friend class iter [friend] |
size_type utilmm::hash_toolbox::table< Key, Value, Extract, Hash, Equal >::avg_bucket_count [private] |
bucket_type utilmm::hash_toolbox::table< Key, Value, Extract, Hash, Equal >::bucket [private] |
size_type utilmm::hash_toolbox::table< Key, Value, Extract, Hash, Equal >::node_count [private] |