template<class key_t,class value_t,class hash_func=id<key_t> > class adevs_hashtable
A hashtable.
Public Methods
-
adevs_hashtable(int min_cap = 0)
-
Default constructor.
-
adevs_hashtable(const adevs_hashtable<key_t, value_t, hash_func>& src)
-
Copy constructor.
-
const adevs_hashtable<key_t,value_t,hash_func> & operator=(const adevs_hashtable<key_t, value_t, hash_func>& src)
-
Assignment operator.
-
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 find(const key_t& key, value_t& value)
-
Looks for key and assigns its associated value to the value argument if it is
found.
-
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()
-
Removes all keys and values
-
std::vector<std::pair<key_t,value_t> > getElements() const
- Get the key,value pairs in this hashtable
-
int getBucketCount() const
- Returns the number of hashing buckets that are available in the table
-
~adevs_hashtable()
- Destructor
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(int min_cap = 0)
-
Default constructor. Creates an empty hashtable. If the min_cap
value is supplied, the hashtable is guaranteed not to need a rehash
until at least that many elements have been inserted.
- adevs_hashtable(const adevs_hashtable<key_t, value_t, hash_func>& src)
-
Copy constructor. Keys and values are copied using the assignment
operator.
- const adevs_hashtable<key_t,value_t,hash_func> & operator=(const adevs_hashtable<key_t, value_t, hash_func>& src)
-
Assignment operator. End result is the same as would have been achieved
using the copy constructor.
- 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 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.
- 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()
-
Removes all keys and values
- std::vector<std::pair<key_t,value_t> > getElements() const
- Get the key,value pairs in this hashtable
- int getBucketCount() const
- Returns the number of hashing buckets that are available in the table
- ~adevs_hashtable()
- Destructor
- This class has no child classes.
Alphabetic index HTML hierarchy of classes or Java
This page was generated with the help of DOC++.