BALL 1.5.0
Loading...
Searching...
No Matches
BALL::HashMap< Key, T > Class Template Reference

HashMap class based on the STL map (containing serveral convenience functions). More...

#include <BALL/DATATYPE/hashMap.h>

Inheritance diagram for BALL::HashMap< Key, T >:
BALL::StringHashMap< JCAMPValue > BALL::StringHashMap< String > BALL::StringHashMap< RuleList > BALL::StringHashMap< CreateMethod > BALL::Options

Classes

class  IllegalKey
 HashMap illegal key exception. More...

OpenMS style typedefs

typedef boost::unordered_map< Key, T > Base
typedef Base::value_type ValueType
typedef Key KeyType
typedef Base::value_type * PointerType
typedef Base::iterator Iterator
typedef Base::const_iterator ConstIterator
bool has (const Key &key) const
 Test whether the map contains the given key.
const T & operator[] (const Key &key) const
 Return a constant reference to the element whose key is key.
T & operator[] (const Key &key)
 Return a mutable reference to the element whose key is key. If an element with the key key does not exist, it is inserted.
bool operator== (const HashMap< Key, T > &rhs) const
 Equality operator. Check whether two two hashmaps contain the same elements. O(n) runtime.
Size size () const

Detailed Description

template<class Key, class T>
class BALL::HashMap< Key, T >

HashMap class based on the STL map (containing serveral convenience functions).

Definition at line 73 of file hashMap.h.

Member Typedef Documentation

◆ Base

template<class Key, class T>
typedef boost::unordered_map<Key, T> BALL::HashMap< Key, T >::Base

Definition at line 93 of file hashMap.h.

◆ ConstIterator

template<class Key, class T>
typedef Base::const_iterator BALL::HashMap< Key, T >::ConstIterator

Definition at line 98 of file hashMap.h.

◆ Iterator

template<class Key, class T>
typedef Base::iterator BALL::HashMap< Key, T >::Iterator

Definition at line 97 of file hashMap.h.

◆ KeyType

template<class Key, class T>
typedef Key BALL::HashMap< Key, T >::KeyType

Definition at line 95 of file hashMap.h.

◆ PointerType

template<class Key, class T>
typedef Base::value_type* BALL::HashMap< Key, T >::PointerType

Definition at line 96 of file hashMap.h.

◆ ValueType

template<class Key, class T>
typedef Base::value_type BALL::HashMap< Key, T >::ValueType

Definition at line 94 of file hashMap.h.

Member Function Documentation

◆ has()

template<class Key, class T>
bool BALL::HashMap< Key, T >::has ( const Key & key) const
inline

Test whether the map contains the given key.

Definition at line 102 of file hashMap.h.

◆ operator==()

template<class Key, class T>
bool BALL::HashMap< Key, T >::operator== ( const HashMap< Key, T > & rhs) const

Equality operator. Check whether two two hashmaps contain the same elements. O(n) runtime.

Definition at line 144 of file hashMap.h.

◆ operator[]() [1/2]

template<class Key, class T>
T & BALL::HashMap< Key, T >::operator[] ( const Key & key)

Return a mutable reference to the element whose key is key. If an element with the key key does not exist, it is inserted.

Definition at line 165 of file hashMap.h.

◆ operator[]() [2/2]

template<class Key, class T>
const T & BALL::HashMap< Key, T >::operator[] ( const Key & key) const

Return a constant reference to the element whose key is key.

Exceptions
IllegalKeyif the given key does not exist

Definition at line 130 of file hashMap.h.

◆ size()

template<class Key, class T>
Size BALL::HashMap< Key, T >::size ( ) const
inline

Return the size of the hash map. TODO: Remove this. This narrows the precision of size_t! (But of course breaks persistence...)

Definition at line 122 of file hashMap.h.