BALL 1.5.0
Loading...
Searching...
No Matches
BALL::StringHashMap< Value > Class Template Reference

#include <BALL/DATATYPE/stringHashMap.h>

Inheritance diagram for BALL::StringHashMap< Value >:
BALL::HashMap< String, Value >

Public Types

Type Definitions
typedef HashMap< String, Value >::Iterator Iterator
typedef HashMap< String, Value >::ConstIterator ConstIterator
typedef HashMap< String, Value >::ValueType ValueType
typedef boost::unordered_map< String, Value > Base
typedef Base::value_type ValueType
typedef String KeyType
typedef Base::value_type * PointerType
typedef Base::iterator Iterator
typedef Base::const_iterator ConstIterator

Public Member Functions

Constructors and Destructors
 StringHashMap ()
 StringHashMap (const StringHashMap &map)
virtual ~StringHashMap ()
void destroy ()
Assignment
void set (const StringHashMap &hash_map)
const StringHashMapoperator= (const StringHashMap &hash_map)
 Assign a hash map from another.
void get (StringHashMap &hash_map) const
 Assigns the content of a hash map to another.
void swap (StringHashMap &hash_map)
 Swaps the contents of two hash maps.
Accessors
std::pair< Iterator, boolinsert (const ValueType &obj)
bool remove (const String &key)
Size getSize () const
Predicates
bool operator== (const StringHashMap< Value > &hash_map) const
bool operator!= (const StringHashMap< Value > &hash_map) const
bool has (const String &key) const
bool isEmpty () const
Miscellaneous
void host (Visitor< StringHashMap< Value > > &visitor)
bool has (const String &key) const
 Test whether the map contains the given key.
const Value & operator[] (const String &key) const
 Return a constant reference to the element whose key is key.
bool operator== (const HashMap< String, Value > &rhs) const
 Equality operator. Check whether two two hashmaps contain the same elements. O(n) runtime.
Size size () const

Detailed Description

template<typename Value>
class BALL::StringHashMap< Value >

StringHashMap

Definition at line 40 of file stringHashMap.h.

Member Typedef Documentation

◆ ConstIterator

template<typename Value>
typedef HashMap<String,Value>::ConstIterator BALL::StringHashMap< Value >::ConstIterator

Const iterator type

Definition at line 57 of file stringHashMap.h.

◆ Iterator

template<typename Value>
typedef HashMap<String,Value>::Iterator BALL::StringHashMap< Value >::Iterator

Iterator type

Definition at line 53 of file stringHashMap.h.

◆ ValueType

template<typename Value>
typedef HashMap<String,Value>::ValueType BALL::StringHashMap< Value >::ValueType

Value type

Definition at line 61 of file stringHashMap.h.

Constructor & Destructor Documentation

◆ StringHashMap() [1/2]

template<typename Value>
BALL::StringHashMap< Value >::StringHashMap ( )
inline

Default constructor. Create an empty hash map.

Definition at line 70 of file stringHashMap.h.

◆ StringHashMap() [2/2]

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

Copy constructor. Create a copy of an existing hash map.

Parameters
mapthe hash map to be copied

Definition at line 79 of file stringHashMap.h.

◆ ~StringHashMap()

template<typename Value>
virtual BALL::StringHashMap< Value >::~StringHashMap ( )
inlinevirtual

Destructor. Destruct the hash map and free all used memory.

Definition at line 87 of file stringHashMap.h.

Member Function Documentation

◆ destroy()

template<typename Value>
void BALL::StringHashMap< Value >::destroy ( )
inline

Clear the hash map. Remove all contents from the hash map.

Definition at line 94 of file stringHashMap.h.

◆ get()

template<typename Value>
void BALL::StringHashMap< Value >::get ( StringHashMap< Value > & hash_map) const
inline

Assigns the content of a hash map to another.

Definition at line 127 of file stringHashMap.h.

◆ getSize()

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

Return the size of the hash map.

Definition at line 182 of file stringHashMap.h.

◆ has()

template<typename Value>
bool BALL::StringHashMap< Value >::has ( const String & key) const
inline

Decide whether the hash map contains a given key.

Definition at line 208 of file stringHashMap.h.

◆ host()

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

Visitor host method. StringHashMaps may be visited.

Parameters
visitorthe visitor

Definition at line 229 of file stringHashMap.h.

◆ insert()

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

Insert a pair of key and value.

Definition at line 145 of file stringHashMap.h.

◆ isEmpty()

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

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

Definition at line 216 of file stringHashMap.h.

◆ operator!=()

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

Compare two string hash maps.

Definition at line 201 of file stringHashMap.h.

◆ operator=()

template<typename Value>
const StringHashMap & BALL::StringHashMap< Value >::operator= ( const StringHashMap< Value > & hash_map)
inline

Assign a hash map from another.

Definition at line 120 of file stringHashMap.h.

◆ operator==()

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

Compare two string hash maps.

Definition at line 194 of file stringHashMap.h.

◆ remove()

template<typename Value>
bool BALL::StringHashMap< Value >::remove ( const String & key)
inline

Insert a given value and key.

Parameters
valuethe value to be inserted
keythe value`s key */ ::std::pair<Iterator, bool> insert(const String& key, const Value& value) { return HashMap<String, Value>::insert(::std::pair<String, Value>(key, value)); }

/** Remove the entry key from the map.

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

Definition at line 164 of file stringHashMap.h.

◆ set()

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

Assign a hash map from another. Create a copy of a hash map.

Parameters
hash_mapthe map to be copied

Definition at line 108 of file stringHashMap.h.

◆ swap()

template<typename Value>
void BALL::StringHashMap< Value >::swap ( StringHashMap< Value > & hash_map)
inline

Swaps the contents of two hash maps.

Definition at line 133 of file stringHashMap.h.