Public Types | Public Member Functions | Private Types | Private Member Functions | Static Private Member Functions | Private Attributes | Friends
utilmm::hash_toolbox::table< Key, Value, Extract, Hash, Equal > Class Template Reference

Hashing based table. More...

#include <table.hh>

List of all members.

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, iteratorequal_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
tableoperator= (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_typenode_type

Private Member Functions

node_type ** find_node (key_arg k)
node_typefind_node (key_arg k) const
size_t hash_node (value_arg v)
node_typeinsert (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

Detailed Description

template<typename Key, typename Value, class Extract, class Hash, class Equal>
class utilmm::hash_toolbox::table< Key, Value, Extract, Hash, Equal >

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

Parameters:
Keythe entry type for this table
ValueThe value type for cells in table
ExtractKey extractor from Value
Hashhashing functor for Key
Equalequality functor for Key
See also:
utilmm::hash
Author:
Frédéric Py <fpy@laas.fr>

Definition at line 46 of file table.hh.


Member Typedef Documentation

template<typename Key, typename Value, class Extract, class Hash, class Equal>
typedef std::vector<node_type *> utilmm::hash_toolbox::table< Key, Value, Extract, Hash, Equal >::bucket_type [private]

Definition at line 60 of file table.hh.

template<typename Key, typename Value, class Extract, class Hash, class Equal>
typedef const_iter<Key, Value, Extract, Hash, Equal> utilmm::hash_toolbox::table< Key, Value, Extract, Hash, Equal >::const_iterator

const iterator type

The type used to iterate through this class without any modification

Definition at line 73 of file table.hh.

template<typename Key, typename Value, class Extract, class Hash, class Equal>
typedef iter<Key, Value, Extract, Hash, Equal> utilmm::hash_toolbox::table< Key, Value, Extract, Hash, Equal >::iterator

iterator type

The type used to iterate through and manipulate this class

Definition at line 67 of file table.hh.

template<typename Key, typename Value, class Extract, class Hash, class Equal>
typedef arg_traits<key_type>::type utilmm::hash_toolbox::table< Key, Value, Extract, Hash, Equal >::key_arg

Definition at line 56 of file table.hh.

template<typename Key, typename Value, class Extract, class Hash, class Equal>
typedef Key utilmm::hash_toolbox::table< Key, Value, Extract, Hash, Equal >::key_type

Key type.

Definition at line 51 of file table.hh.

template<typename Key, typename Value, class Extract, class Hash, class Equal>
typedef node<value_type> utilmm::hash_toolbox::table< Key, Value, Extract, Hash, Equal >::node_type [private]

Definition at line 59 of file table.hh.

template<typename Key, typename Value, class Extract, class Hash, class Equal>
typedef size_t utilmm::hash_toolbox::table< Key, Value, Extract, Hash, Equal >::size_type

Size type.

Definition at line 53 of file table.hh.

template<typename Key, typename Value, class Extract, class Hash, class Equal>
typedef arg_traits<value_type>::type utilmm::hash_toolbox::table< Key, Value, Extract, Hash, Equal >::value_arg

Definition at line 55 of file table.hh.

template<typename Key, typename Value, class Extract, class Hash, class Equal>
typedef Value utilmm::hash_toolbox::table< Key, Value, Extract, Hash, Equal >::value_type

Value type for cells.

Definition at line 49 of file table.hh.


Constructor & Destructor Documentation

template<typename Key, typename Value, class Extract, class Hash, class Equal>
utilmm::hash_toolbox::table< Key, Value, Extract, Hash, Equal >::table ( )

Default constructor.

Create an empty table

template<typename Key, typename Value, class Extract, class Hash, class Equal>
utilmm::hash_toolbox::table< Key, Value, Extract, Hash, Equal >::table ( table< Key, Value, Extract, Hash, Equal > const &  )

Copy constructor.

template<typename Key, typename Value, class Extract, class Hash, class Equal>
utilmm::hash_toolbox::table< Key, Value, Extract, Hash, Equal >::~table ( )

Copy destructor.


Member Function Documentation

template<typename Key, typename Value, class Extract, class Hash, class Equal>
iterator utilmm::hash_toolbox::table< Key, Value, Extract, Hash, Equal >::begin ( )

Beginning of table.

Returns:
an iterator pointing to the beginning of the container
See also:
end()
template<typename Key, typename Value, class Extract, class Hash, class Equal>
const_iterator utilmm::hash_toolbox::table< Key, Value, Extract, Hash, Equal >::begin ( ) const

Beginning of table.

Returns:
a const iterator pointing to the beginning of the container
See also:
end() const
template<typename Key, typename Value, class Extract, class Hash, class Equal>
void utilmm::hash_toolbox::table< Key, Value, Extract, Hash, Equal >::clear ( )

remove all elements

This function is strictly equivelent to erase(begin(), end())

template<typename Key, typename Value, class Extract, class Hash, class Equal>
static bucket_type utilmm::hash_toolbox::table< Key, Value, Extract, Hash, Equal >::copy_bucket ( bucket_type const &  other) [static, private]
template<typename Key, typename Value, class Extract, class Hash, class Equal>
bool utilmm::hash_toolbox::table< Key, Value, Extract, Hash, Equal >::empty ( ) const

Emptyness test.

Return values:
trueif this instance has no element
falseelse
See also:
size() const
template<typename Key, typename Value, class Extract, class Hash, class Equal>
iterator utilmm::hash_toolbox::table< Key, Value, Extract, Hash, Equal >::end ( )

End of table.

Returns:
an iterator pointing to the end of the container
See also:
begin()
template<typename Key, typename Value, class Extract, class Hash, class Equal>
const_iterator utilmm::hash_toolbox::table< Key, Value, Extract, Hash, Equal >::end ( ) const

End of table.

Returns:
a const iterator pointing to the end of the container
See also:
begin() const
template<typename Key, typename Value, class Extract, class Hash, class Equal>
std::pair<iterator, iterator> utilmm::hash_toolbox::table< Key, Value, Extract, Hash, Equal >::equal_range ( key_arg  key)

equality range

Parameters:
keya Key

This function tries to fuind all the elements of this table with a key equal to key

Returns:
a pair where [first, second[ corresponds to all the elements whose key is equal to key
template<typename Key, typename Value, class Extract, class Hash, class Equal>
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

Parameters:
keya Key

This function tries to fuind all the elements of this table with a key equal to key

Returns:
a pair where [first, second[ corresponds to all the elements whose key is equal to key
template<typename Key, typename Value, class Extract, class Hash, class Equal>
void utilmm::hash_toolbox::table< Key, Value, Extract, Hash, Equal >::erase ( iterator const &  first,
iterator const &  last 
)

Remove elements.

Parameters:
firstan iterator
lastan iterator

removes all the element of the table in the range [first, last [

template<typename Key, typename Value, class Extract, class Hash, class Equal>
node_type** utilmm::hash_toolbox::table< Key, Value, Extract, Hash, Equal >::find_node ( key_arg  k) [private]
template<typename Key, typename Value, class Extract, class Hash, class Equal>
node_type* utilmm::hash_toolbox::table< Key, Value, Extract, Hash, Equal >::find_node ( key_arg  k) const [private]
template<typename Key, typename Value, class Extract, class Hash, class Equal>
static key_type const& utilmm::hash_toolbox::table< Key, Value, Extract, Hash, Equal >::get_key ( value_arg  v) [static, private]
template<typename Key, typename Value, class Extract, class Hash, class Equal>
static size_t utilmm::hash_toolbox::table< Key, Value, Extract, Hash, Equal >::hash_key ( key_arg  k,
size_type  mod 
) [static, private]
template<typename Key, typename Value, class Extract, class Hash, class Equal>
static size_t utilmm::hash_toolbox::table< Key, Value, Extract, Hash, Equal >::hash_node ( value_arg  v,
size_type  mod 
) [static, private]
template<typename Key, typename Value, class Extract, class Hash, class Equal>
size_t utilmm::hash_toolbox::table< Key, Value, Extract, Hash, Equal >::hash_node ( value_arg  v) [private]
template<typename Key, typename Value, class Extract, class Hash, class Equal>
node_type* utilmm::hash_toolbox::table< Key, Value, Extract, Hash, Equal >::insert ( node_type **  helper,
value_arg  v 
) [private]
template<typename Key, typename Value, class Extract, class Hash, class Equal>
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

Returns:
an iterator pointing to the position where v was inserted
template<typename Key, typename Value, class Extract, class Hash, class Equal>
std::pair<iterator, bool> utilmm::hash_toolbox::table< Key, Value, Extract, Hash, Equal >::insert_unique ( value_arg  v)

Unique key insertion.

Parameters:
vThe 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

Returns:
a pair where 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
template<typename Key, typename Value, class Extract, class Hash, class Equal>
size_type utilmm::hash_toolbox::table< Key, Value, Extract, Hash, Equal >::max_size ( ) const

max elmement number

Returns:
The maximum possible number of elements
template<typename Key, typename Value, class Extract, class Hash, class Equal>
table& utilmm::hash_toolbox::table< Key, Value, Extract, Hash, Equal >::operator= ( table< Key, Value, Extract, Hash, Equal > const &  other)

Copy operator.

template<typename Key, typename Value, class Extract, class Hash, class Equal>
void utilmm::hash_toolbox::table< Key, Value, Extract, Hash, Equal >::resize ( size_type  size) [private]
template<typename Key, typename Value, class Extract, class Hash, class Equal>
size_type utilmm::hash_toolbox::table< Key, Value, Extract, Hash, Equal >::size ( ) const

element count

Returns:
the number of element present in current container
template<typename Key, typename Value, class Extract, class Hash, class Equal>
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.

Parameters:
otherThe other instance

Friends And Related Function Documentation

template<typename Key, typename Value, class Extract, class Hash, class Equal>
friend class const_iter [friend]

Definition at line 231 of file table.hh.

template<typename Key, typename Value, class Extract, class Hash, class Equal>
friend class iter [friend]

Definition at line 228 of file table.hh.


Member Data Documentation

template<typename Key, typename Value, class Extract, class Hash, class Equal>
size_type utilmm::hash_toolbox::table< Key, Value, Extract, Hash, Equal >::avg_bucket_count [private]

Definition at line 210 of file table.hh.

template<typename Key, typename Value, class Extract, class Hash, class Equal>
bucket_type utilmm::hash_toolbox::table< Key, Value, Extract, Hash, Equal >::bucket [private]

Definition at line 209 of file table.hh.

template<typename Key, typename Value, class Extract, class Hash, class Equal>
size_type utilmm::hash_toolbox::table< Key, Value, Extract, Hash, Equal >::node_count [private]

Definition at line 210 of file table.hh.


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


utilmm
Author(s): Sylvain Joyeux/sylvain.joyeux@m4x.org
autogenerated on Mon Oct 6 2014 03:17:02