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

A hashtable.

Public Methods

[more] adevs_hashtable(int min_cap = 0)
Default constructor.
[more] adevs_hashtable(const adevs_hashtable<key_t, value_t, hash_func>& src)
Copy constructor.
[more]const adevs_hashtable<key_t,value_t,hash_func> & operator=(const adevs_hashtable<key_t, value_t, hash_func>& src)
Assignment operator.
[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()
Removes all keys and values
[more]std::vector<std::pair<key_t,value_t> > getElements() const
Get the key,value pairs in this hashtable
[more]int getBucketCount() const
Returns the number of hashing buckets that are available in the table
[more] ~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.
o 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.

o adevs_hashtable(const adevs_hashtable<key_t, value_t, hash_func>& src)
Copy constructor. Keys and values are copied using the assignment operator.

oconst 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.

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()
Removes all keys and values

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

oint getBucketCount() const
Returns the number of hashing buckets that are available in the table

o ~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++.