Main Page | Modules | Namespace List | Class Hierarchy | Class List | Namespace Members | Class Members

StringHashMap< Value > Class Template Reference
[Generic Hash Associative Containers]

StringHashMap. More...

#include <stringHashMap.h>

Inheritance diagram for StringHashMap< Value >:

HashMap< String, Value > List of all members.

Public Types

Type Definitions
typedef HashMap< String, Value
>::Iterator 
Iterator
 Iterator type.
typedef HashMap< String, Value
>::ConstIterator 
ConstIterator
 Const iterator type.
typedef HashMap< String, Value
>::ValueType 
ValueType
 Value type.

Public Member Functions

Constructors and Destructors
 StringHashMap () throw ()
 Default constructor.
 StringHashMap (const StringHashMap &map) throw ()
 Copy constructor.
virtual ~StringHashMap () throw ()
 Destructor.
void destroy () throw ()
 Clear the hash map.
Assignment
void set (const StringHashMap &hash_map) throw ()
 Assign a hash map from another.
const StringHashMapoperator= (const StringHashMap &hash_map) throw ()
 Assign a hash map from another.
void get (StringHashMap &hash_map) const throw ()
 Assigns the content of a hash map to another.
void swap (StringHashMap &hash_map) throw ()
 Swaps the contents of two hash maps.
Accessors
std::pair< Iterator, bool > insert (const ValueType &obj) throw ()
 Insert a pair of key and value.
::std::pair< Iterator, bool > insert (const String &key, const Value &value) throw ()
 Insert a given value and key.
bool remove (const String &key) throw ()
 Remove the entry key from the map.
Size getSize () const throw ()
 Return the size of the hash map.
float getLoadFactor () const throw ()
 Return the load factor of the hash map.
Predicates
bool operator== (const StringHashMap< Value > &hash_map) const throw ()
 Compare two string hash maps.
bool operator!= (const StringHashMap< Value > &hash_map) const throw ()
 Compare two string hash maps.
bool has (const String &key) const throw ()
 Decide whether the hash map contains a given key.
bool isEmpty () const throw ()
 Return true if the hash map is empty.
Miscellaneous
void host (Visitor< StringHashMap< Value > > &visitor) throw ()
 Visitor host method.

Detailed Description

template<typename Value>
class StringHashMap< Value >

StringHashMap.


Constructor & Destructor Documentation

template<typename Value>
StringHashMap< Value >::StringHashMap  )  throw ()
 

Default constructor.

Create an empty hash map.

template<typename Value>
StringHashMap< Value >::StringHashMap const StringHashMap< Value > &  map  )  throw ()
 

Copy constructor.

Create a copy of an existing hash map.

Parameters:
map the hash map to be copied

template<typename Value>
virtual StringHashMap< Value >::~StringHashMap  )  throw () [virtual]
 

Destructor.

Destruct the hash map and free all used memory.


Member Function Documentation

template<typename Value>
void StringHashMap< Value >::destroy  )  throw ()
 

Clear the hash map.

Remove all contents from the hash map.

Reimplemented from HashMap< String, Value >.

template<typename Value>
float StringHashMap< Value >::getLoadFactor  )  const throw ()
 

Return the load factor of the hash map.

The load factor is defined as the quotient of the hash map size (the number of entries) and the number of buckets.

template<typename Value>
Size StringHashMap< Value >::getSize  )  const throw ()
 

Return the size of the hash map.

Reimplemented from HashMap< String, Value >.

template<typename Value>
bool StringHashMap< Value >::has const String key  )  const throw ()
 

Decide whether the hash map contains a given key.

Reimplemented from HashMap< String, Value >.

template<typename Value>
void StringHashMap< Value >::host Visitor< StringHashMap< Value > > &  visitor  )  throw ()
 

Visitor host method.

StringHashMaps may be visited.

Parameters:
visitor the visitor

template<typename Value>
::std::pair<Iterator, bool> StringHashMap< Value >::insert const String key,
const Value &  value
throw ()
 

Insert a given value and key.

Parameters:
value the value to be inserted
key the value`s key

template<typename Value>
std::pair<Iterator, bool> StringHashMap< Value >::insert const ValueType obj  )  throw ()
 

Insert a pair of key and value.

Reimplemented from HashMap< String, Value >.

template<typename Value>
bool StringHashMap< Value >::isEmpty  )  const throw ()
 

Return true if the hash map is empty.

This method return true if the hash map does not contain any entries.

Reimplemented from HashMap< String, Value >.

template<typename Value>
bool StringHashMap< Value >::operator!= const StringHashMap< Value > &  hash_map  )  const throw ()
 

Compare two string hash maps.

template<typename Value>
bool StringHashMap< Value >::operator== const StringHashMap< Value > &  hash_map  )  const throw ()
 

Compare two string hash maps.

template<typename Value>
bool StringHashMap< Value >::remove const String key  )  throw ()
 

Remove the entry key from the map.

Parameters:
key the key of the entry to be removed
Returns:
bool true if the key was removed

template<typename Value>
void StringHashMap< Value >::set const StringHashMap< Value > &  hash_map  )  throw ()
 

Assign a hash map from another.

Create a copy of a hash map.

Parameters:
hash_map the map to be copied