35 #ifndef OPENMS_DATASTRUCTURES_MAP_H 36 #define OPENMS_DATASTRUCTURES_MAP_H 39 #include <OpenMS/config.h> 50 template <
class Key,
class T>
52 private std::map<Key, T>
68 IllegalKey(
const char* file,
int line,
const char*
function) :
77 typedef std::map<Key, T>
Base;
101 using typename Base::iterator;
102 using typename Base::const_iterator;
104 using typename Base::mapped_type;
105 using typename Base::value_type;
109 inline bool has(
const Key& key)
const 111 return Base::find(key) != Base::end();
139 template <
class Key,
class T>
143 if (it == Base::end())
145 throw IllegalKey(__FILE__, __LINE__, OPENMS_PRETTY_FUNCTION);
153 template <
class Key,
class T>
157 if (it == Base::end())
159 it = this->insert(
ValueType(key, T())).first;
166 #endif // OPENMS_DATASTRUCTURES_MAP_H Base::value_type * PointerType
Definition: Map.h:80
Base::iterator Iterator
Definition: Map.h:81
Base::const_reverse_iterator ConstReverseIterator
Definition: Map.h:84
bool operator==(_Iterator< _Val, _Ref, _Ptr > const &, _Iterator< _Val, _Ref, _Ptr > const &)
Definition: KDTree.h:806
Base::reverse_iterator ReverseIterator
Definition: Map.h:83
Main OpenMS namespace.
Definition: FeatureDeconvolution.h:47
Map illegal key exception.
Definition: Map.h:64
Key KeyType
Definition: Map.h:79
bool has(const Key &key) const
Test whether the map contains the given key.
Definition: Map.h:109
Exception base class.
Definition: Exception.h:90
Base::const_iterator ConstIterator
Definition: Map.h:82
std::map< Key, T > Base
Definition: Map.h:77
IllegalKey(const char *file, int line, const char *function)
Definition: Map.h:68
BaseException() noexcept
Default constructor.
bool equals(const Map< Key, T > &other) const
Definition: Map.h:125
const T & operator[](const Key &key) const
Return a constant reference to the element whose key is key.
Definition: Map.h:140
Map class based on the STL map (containing several convenience functions)
Definition: Map.h:51
Base::value_type ValueType
Definition: Map.h:78