Creates an empty hash table. This causes some heap allocation to occur.
template<class Key, class Value, class HashFunc = GHashCode<Key>>
Destroys all of the memory allocated by the table, but does not call delete on keys or values if they are pointers. If you want to deallocate things that the table points at, use getKeys() and Array::deleteAll() to delete them.
template<class Key, class Value, class HashFunc = GHashCode<Key>>
Member Function Documentation
template<class Key, class Value, class HashFunc = GHashCode<Key>>
C++ STL style iterator method. Returns the first Entry, which contains a key and value. Use preincrement (++entry) to get to the next element. Do not modify the table while iterating.
template<class Key, class Value, class HashFunc = GHashCode<Key>>
Removes all elements.
template<class Key, class Value, class HashFunc = GHashCode<Key>>
Returns true if key is in the table.
template<class Key, class Value, class HashFunc = GHashCode<Key>>
Returns the length of the deepest bucket.
template<class Key, class Value, class HashFunc = GHashCode<Key>>
A small load (close to zero) means the hash table is acting very efficiently most of the time. A large load (close to 1) means the hash table is acting poorly-- all operations will be very slow. A large load will result from a bad hash function that maps too many keys to the same code.
template<class Key, class Value, class HashFunc = GHashCode<Key>>
Returns the number of buckets.
template<class Key, class Value, class HashFunc = GHashCode<Key>>
Calls delete on all of the keys. Does not clear the table, however, so you are left with a table of dangling pointers.
Same as To delete all of the values, you may want something like
Array<Key> keys = table.getKeys();
Set<Value> value;
for (int k = 0; k < keys.length(); k++) {
value.insert(keys[k]);
}
value.getMembers().deleteAll();
keys.deleteAll();
template<class Key, class Value, class HashFunc = GHashCode<Key>>
Calls delete on all of the values. This is unsafe-- do not call unless you know that each value appears at most once. Does not clear the table, so you are left with a table of dangling pointers.
template<class Key, class Value, class HashFunc = GHashCode<Key>>
C++ STL style iterator method. Returns one after the last iterator element.
template<class Key, class Value, class HashFunc = GHashCode<Key>>
If the key is present in the table, val is set to the associated value and returns true. If the key is not present, returns false.
template<class Key, class Value, class HashFunc = GHashCode<Key>>
template<class Key, class Value, class HashFunc = GHashCode<Key>>
template<class Key, class Value, class HashFunc = GHashCode<Key>>
Returns an array of all of the keys in the table. You can iterate over the keys to get the values.
template<class Key, class Value, class HashFunc = GHashCode<Key>>
template<class Key, class Value, class HashFunc = GHashCode<Key>>
Short syntax for get.
template<class Key, class Value, class HashFunc = GHashCode<Key>>
Removes an element from the table if it is present. It is an error to remove an element that isn't present.
template<class Key, class Value, class HashFunc = GHashCode<Key>>
If you insert a pointer into the key or value of a table, you are responsible for deallocating the object eventually. Inserting key into a table is O(1), but may cause a potentially slow rehashing.
template<class Key, class Value, class HashFunc = GHashCode<Key>>
Returns the number of keys.
The documentation for this class was generated from the following file: Generated on Thu Aug 2 11:40:48 2007 for G3D by | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||