35 #ifndef OPENMS_DATASTRUCTURES_MAP_H
36 #define OPENMS_DATASTRUCTURES_MAP_H
49 template <
class Key,
class T>
51 public std::map<Key, T>
67 IllegalKey(
const char * file,
int line,
const char *
function) :
76 typedef std::map<Key, T>
Base;
87 inline bool has(
const Key & key)
const
89 return Base::find(key) != Base::end();
107 template <
class Key,
class T>
111 if (it == Base::end())
113 throw IllegalKey(__FILE__, __LINE__, __PRETTY_FUNCTION__);
121 template <
class Key,
class T>
125 if (it == Base::end())
127 it = this->insert(
ValueType(key, T())).first;
134 #endif // OPENMS_DATASTRUCTURES_MAP_H
BaseException()
Default constructor.
Base::value_type * PointerType
Definition: Map.h:79
Base::iterator Iterator
Definition: Map.h:80
bool has(const Key &key) const
Test whether the map contains the given key.
Definition: Map.h:87
Base::const_reverse_iterator ConstReverseIterator
Definition: Map.h:83
Base::reverse_iterator ReverseIterator
Definition: Map.h:82
Map illegal key exception.
Definition: Map.h:63
Key KeyType
Definition: Map.h:78
const T & operator[](const Key &key) const
Return a constant reference to the element whose key is key.
Definition: Map.h:108
Exception base class.
Definition: Exception.h:90
Base::const_iterator ConstIterator
Definition: Map.h:81
std::map< Key, T > Base
Definition: Map.h:76
IllegalKey(const char *file, int line, const char *function)
Definition: Map.h:67
Map class based on the STL map (containing serveral convenience functions)
Definition: Map.h:50
Base::value_type ValueType
Definition: Map.h:77