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_MAP_NAME

List of all members.

Classes

class  IllegalKey
 HashMap illegal key exception. More...

Public Types

OpenMS style typedefs
typedef BALL_MAP_NAME Base
typedef Base::value_type ValueType
typedef Key KeyType
typedef Base::value_type * PointerType
typedef Base::iterator Iterator
typedef Base::const_iterator ConstIterator

Public Member Functions

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)


Member Typedef Documentation

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

Member Function Documentation

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.

References BALL::HashMap< Key, T >::has(), and BALL::HashMap< Key, T >::size().

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

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