template<class key_t,class value_t,class hash_func=id<key_t> > class adevs_hashtable
A hashtable.
Public Methods
-
adevs_hashtable()
-
adevs_hashtable(const adevs_hashtable<key_t, value_t, hash_func>& src)
-
const adevs_hashtable<key_t,value_t,hash_func> & operator=(const adevs_hashtable<key_t, value_t, hash_func>& src)
-
void insert(const key_t& key, const value_t& value)
-
Add an item.
-
void remove(const key_t& key)
-
Remove the item associated with the supplied key
-
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
-
const value_t& find(const key_t &key)
-
Returns a constant reference to the value associated with the supplied
key
-
bool contains(const key_t& key) const
- Returns true if the key exists in the hashtable, false otherwise
-
int getSize() const
- Gives the number of keys in the hashtable
-
void clear()
-
Deletes all buckets, sets the table key count to 0
-
std::vector<std::pair<key_t,value_t> > getElements() const
- Get the list of key,value pairs in this hashtable
-
int getBucketCount() const
-
int getRehashCount() const
-
~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.
adevs_hashtable()
adevs_hashtable(const adevs_hashtable<key_t, value_t, hash_func>& src)
const adevs_hashtable<key_t,value_t,hash_func> & operator=(const adevs_hashtable<key_t, value_t, hash_func>& src)
void insert(const key_t& key, const value_t& value)
-
Add an item. This replaces the existing item with that key.
void remove(const key_t& key)
-
Remove the item associated with the supplied key
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
const value_t& find(const key_t &key)
-
Returns a constant reference to the value associated with the supplied
key
bool contains(const key_t& key) const
- Returns true if the key exists in the hashtable, false otherwise
int getSize() const
- Gives the number of keys in the hashtable
void clear()
-
Deletes all buckets, sets the table key count to 0
std::vector<std::pair<key_t,value_t> > getElements() const
- Get the list of key,value pairs in this hashtable
int getBucketCount() const
int getRehashCount() const
~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++.