template<class key_t,class value_t,class hash_func=id<key_t> > class adevs_hashtable

A hashtable.

Public Methods

[more] adevs_hashtable()
[more] adevs_hashtable(const adevs_hashtable<key_t, value_t, hash_func>& src)
[more]const adevs_hashtable<key_t,value_t,hash_func> & operator=(const adevs_hashtable<key_t, value_t, hash_func>& src)
[more]void insert(const key_t& key, const value_t& value)
Add an item.
[more]void remove(const key_t& key)
Remove the item associated with the supplied key
[more]value_t& operator[](const key_t& key)
Returns the value associated with key or inserts a new value if key not found The new value is constructed using the default (no argument) constructor
[more]const value_t& find(const key_t &key)
Returns a constant reference to the value associated with the supplied key
[more]bool find(const key_t& key, value_t& value)
Looks for key and assigns its associated value to the value argument if it is found.
[more]bool contains(const key_t& key) const
Returns true if the key exists in the hashtable, false otherwise
[more]int getSize() const
Gives the number of keys in the hashtable
[more]void clear()
Deletes all buckets, sets the table key count to 0
[more]std::vector<std::pair<key_t,value_t> > getElements() const
Get the list of key,value pairs in this hashtable
[more]int getBucketCount() const
[more]int getRehashCount() const
[more] ~adevs_hashtable()


Documentation

A hashtable. Key equivalence is defined by the == operator. Keys and values must support the equality and assignment operators. The hash_func must be a class that supports the function operator() where the function operator accepts a const reference to a key and returns an integer hashcode.
o adevs_hashtable()

o adevs_hashtable(const adevs_hashtable<key_t, value_t, hash_func>& src)

oconst adevs_hashtable<key_t,value_t,hash_func> & operator=(const adevs_hashtable<key_t, value_t, hash_func>& src)

ovoid insert(const key_t& key, const value_t& value)
Add an item. This replaces the existing item with that key.

ovoid remove(const key_t& key)
Remove the item associated with the supplied key

ovalue_t& operator[](const key_t& key)
Returns the value associated with key or inserts a new value if key not found The new value is constructed using the default (no argument) constructor

oconst value_t& find(const key_t &key)
Returns a constant reference to the value associated with the supplied key

obool find(const key_t& key, value_t& value)
Looks for key and assigns its associated value to the value argument if it is found. The method returns true if the key was found and false otherwise.

obool contains(const key_t& key) const
Returns true if the key exists in the hashtable, false otherwise

oint getSize() const
Gives the number of keys in the hashtable

ovoid clear()
Deletes all buckets, sets the table key count to 0

ostd::vector<std::pair<key_t,value_t> > getElements() const
Get the list of key,value pairs in this hashtable

oint getBucketCount() const

oint getRehashCount() const

o ~adevs_hashtable()


This class has no child classes.

Alphabetic index HTML hierarchy of classes or Java



This page was generated with the help of DOC++.