Chemical Data Processing Library C++ API - Version 1.4.0
MultiMap.hpp
Go to the documentation of this file.
1 /*
2  * MultiMap.hpp
3  *
4  * This file is part of the Chemical Data Processing Toolkit
5  *
6  * Copyright (C) 2003 Thomas Seidel <thomas.seidel@univie.ac.at>
7  *
8  * This library is free software; you can redistribute it and/or
9  * modify it under the terms of the GNU Lesser General Public
10  * License as published by the Free Software Foundation; either
11  * version 2 of the License, or (at your option) any later version.
12  *
13  * This library is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16  * Lesser General Public License for more details.
17  *
18  * You should have received a copy of the GNU Lesser General Public License
19  * along with this library; see the file COPYING. If not, write to
20  * the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
21  * Boston, MA 02111-1307, USA.
22  */
23 
29 #ifndef CDPL_UTIL_MULTIMAP_HPP
30 #define CDPL_UTIL_MULTIMAP_HPP
31 
32 #include <map>
33 #include <functional>
34 #include <utility>
35 #include <string>
36 #include <cstddef>
37 #include <memory>
38 
39 #include "CDPL/Base/Exceptions.hpp"
40 
41 
42 namespace CDPL
43 {
44 
45  namespace Util
46  {
47 
48  template <typename ValueType, bool Allow = true>
50  {
51 
52  static const ValueType& get()
53  {
54  return defValue;
55  }
56 
57  static const ValueType defValue;
58  };
59 
60  template <typename ValueType, bool Allow>
61  const ValueType MultiMapDefaultValue<ValueType, Allow>::defValue = ValueType();
62 
63  template <typename ValueType>
64  struct MultiMapDefaultValue<ValueType, false>
65  {
66 
67  static const ValueType& get()
68  {
69  throw Base::OperationFailed("MultiMap: default value not supported");
70  }
71  };
72 
93  template <typename Key, typename Value, bool AllowDefValues = false,
94  typename KeyCompFunc = std::less<Key> >
95  class MultiMap
96  {
97 
98  typedef std::multimap<Key, Value, KeyCompFunc> StorageType;
99 
100  public:
104  typedef std::shared_ptr<MultiMap> SharedPointer;
105 
109  typedef Key KeyType;
110 
114  typedef Value ValueType;
115 
122  typedef typename StorageType::value_type Entry;
123 
127  typedef typename StorageType::const_iterator ConstEntryIterator;
128 
132  typedef typename StorageType::const_reverse_iterator ConstReverseEntryIterator;
133 
137  typedef typename StorageType::iterator EntryIterator;
138 
142  typedef typename StorageType::reverse_iterator ReverseEntryIterator;
143 
147  typedef typename std::pair<EntryIterator, EntryIterator> EntryIteratorRange;
148 
152  typedef typename std::pair<ConstEntryIterator, ConstEntryIterator> ConstEntryIteratorRange;
153 
158  data() {}
159 
164  MultiMap(const KeyCompFunc& func):
165  data(func) {}
166 
172  template <typename InputIter>
173  MultiMap(const InputIter& first, const InputIter& last):
174  data(first, last)
175  {}
176 
184  template <typename InputIter>
185  MultiMap(const InputIter& first, const InputIter& last, const KeyCompFunc& func):
186  data(first, last, func)
187  {}
188 
192  virtual ~MultiMap() {}
193 
198  StorageType& getData();
199 
204  const StorageType& getData() const;
205 
210  std::size_t getSize() const;
211 
216  bool isEmpty() const;
217 
221  void clear();
222 
227  void swap(MultiMap& map);
228 
233  KeyCompFunc getKeyCompareFunction() const;
234 
240  std::size_t getNumEntries(const Key& key) const;
241 
254 
266  ConstEntryIteratorRange getEntries(const Key& key) const;
267 
278  EntryIterator getEntry(const Key& key);
279 
290  ConstEntryIterator getEntry(const Key& key) const;
291 
306  Value& getValue(const Key& key);
307 
322  Value& getValue(const Key& key, Value& def_value);
323 
339  const Value& getValue(const Key& key) const;
340 
355  const Value& getValue(const Key& key, const Value& def_value) const;
356 
368  Value& operator[](const Key& key);
369 
381  const Value& operator[](const Key& key) const;
382 
387  void removeEntry(const EntryIterator& it);
388 
393  bool removeEntry(const Key& key);
394 
400  void removeEntries(const EntryIterator& first, const EntryIterator& last);
401 
407  std::size_t removeEntries(const Key& key);
408 
415 
422  EntryIterator insertEntry(const Key& key, const Value& value);
423 
435  EntryIterator insertEntry(const EntryIterator& it, const Entry& item);
436 
450  EntryIterator insertEntry(const EntryIterator& it, const Key& key, const Value& value);
451 
463 
475  EntryIterator setEntry(const Key& key, const Value& value);
476 
486  template <typename InputIter>
487  void insertEntries(const InputIter& first, const InputIter& last);
488 
499  template <typename InputIter>
500  void setEntries(const InputIter& first, const InputIter& last);
501 
507  EntryIterator getLowerBound(const Key& key);
508 
514  ConstEntryIterator getLowerBound(const Key& key) const;
515 
521  EntryIterator getUpperBound(const Key& key);
522 
528  ConstEntryIterator getUpperBound(const Key& key) const;
529 
535 
541 
547 
553 
559 
565 
571 
577 
583 
589 
595 
601 
602  protected:
630  virtual const char* getClassName() const;
631 
632  private:
633  const Value& getDefaultValue() const;
634 
635  StorageType data;
636  };
637 
646  template <typename Key, typename Value, bool AllowDefValues, typename KeyCompFunc>
649 
658  template <typename Key, typename Value, bool AllowDefValues, typename KeyCompFunc>
661 
670  template <typename Key, typename Value, bool AllowDefValues, typename KeyCompFunc>
673 
682  template <typename Key, typename Value, bool AllowDefValues, typename KeyCompFunc>
685 
694  template <typename Key, typename Value, bool AllowDefValues, typename KeyCompFunc>
697 
706  template <typename Key, typename Value, bool AllowDefValues, typename KeyCompFunc>
709 
710  } // namespace Util
711 } // namespace CDPL
712 
713 
714 // Implementation
715 
716 template <typename Key, typename Value, bool AllowDefValues, typename KeyCompFunc>
717 typename CDPL::Util::MultiMap<Key, Value, AllowDefValues, KeyCompFunc>::StorageType&
719 {
720  return data;
721 }
722 
723 template <typename Key, typename Value, bool AllowDefValues, typename KeyCompFunc>
724 const typename CDPL::Util::MultiMap<Key, Value, AllowDefValues, KeyCompFunc>::StorageType&
726 {
727  return data;
728 }
729 
730 template <typename Key, typename Value, bool AllowDefValues, typename KeyCompFunc>
732 {
733  return data.size();
734 }
735 
736 template <typename Key, typename Value, bool AllowDefValues, typename KeyCompFunc>
738 {
739  return data.empty();
740 }
741 
742 template <typename Key, typename Value, bool AllowDefValues, typename KeyCompFunc>
744 {
745  data.clear();
746 }
747 
748 template <typename Key, typename Value, bool AllowDefValues, typename KeyCompFunc>
750 {
751  data.swap(map.data);
752 }
753 
754 template <typename Key, typename Value, bool AllowDefValues, typename KeyCompFunc>
756 {
757  return data.key_comp();
758 }
759 
760 template <typename Key, typename Value, bool AllowDefValues, typename KeyCompFunc>
762 {
763  return data.count(key);
764 }
765 
766 template <typename Key, typename Value, bool AllowDefValues, typename KeyCompFunc>
769 {
770  return data.find(key);
771 }
772 
773 template <typename Key, typename Value, bool AllowDefValues, typename KeyCompFunc>
776 {
777  return data.find(key);
778 }
779 
780 template <typename Key, typename Value, bool AllowDefValues, typename KeyCompFunc>
783 {
784  return data.equal_range(key);
785 }
786 
787 template <typename Key, typename Value, bool AllowDefValues, typename KeyCompFunc>
790 {
791  return data.equal_range(key);
792 }
793 
794 template <typename Key, typename Value, bool AllowDefValues, typename KeyCompFunc>
796 {
797  EntryIterator lb = data.lower_bound(key);
798 
799  if (lb == data.end() || data.key_comp()(key, (*lb).first)) {
800  if (!AllowDefValues)
801  throw Base::ItemNotFound(std::string(getClassName()) + ": key not found");
802 
803  return (*data.insert(lb, Entry(key, getDefaultValue()))).second;
804  }
805 
806  return (*lb).second;
807 }
808 
809 template <typename Key, typename Value, bool AllowDefValues, typename KeyCompFunc>
811 {
812  EntryIterator it = data.find(key);
813 
814  if (it == data.end())
815  return def_value;
816 
817  return (*it).second;
818 }
819 
820 template <typename Key, typename Value, bool AllowDefValues, typename KeyCompFunc>
822 {
823  ConstEntryIterator it = data.find(key);
824 
825  if (it == data.end()) {
826  if (!AllowDefValues)
827  throw Base::ItemNotFound(std::string(getClassName()) + ": key not found");
828 
829  return getDefaultValue();
830  }
831 
832  return (*it).second;
833 }
834 
835 template <typename Key, typename Value, bool AllowDefValues, typename KeyCompFunc>
837  const Value& def_value) const
838 {
839  ConstEntryIterator it = data.find(key);
840 
841  if (it == data.end())
842  return def_value;
843 
844  return (*it).second;
845 }
846 
847 template <typename Key, typename Value, bool AllowDefValues, typename KeyCompFunc>
849 {
850  return getValue(key);
851 }
852 
853 template <typename Key, typename Value, bool AllowDefValues, typename KeyCompFunc>
855 {
856  return getValue(key);
857 }
858 
859 template <typename Key, typename Value, bool AllowDefValues, typename KeyCompFunc>
861 {
862  data.erase(it);
863 }
864 
865 template <typename Key, typename Value, bool AllowDefValues, typename KeyCompFunc>
867 {
868  EntryIterator it = data.find(key);
869 
870  if (it == data.end())
871  return false;
872 
873  data.erase(it);
874  return true;
875 }
876 
877 template <typename Key, typename Value, bool AllowDefValues, typename KeyCompFunc>
879 {
880  return data.erase(key);
881 }
882 
883 template <typename Key, typename Value, bool AllowDefValues, typename KeyCompFunc>
885  const EntryIterator& last)
886 {
887  data.erase(first, last);
888 }
889 
890 template <typename Key, typename Value, bool AllowDefValues, typename KeyCompFunc>
893 {
894  return data.insert(item);
895 }
896 
897 template <typename Key, typename Value, bool AllowDefValues, typename KeyCompFunc>
900 {
901  return data.insert(Entry(key, value));
902 }
903 
904 template <typename Key, typename Value, bool AllowDefValues, typename KeyCompFunc>
907 {
908  return data.insert(it, item);
909 }
910 
911 template <typename Key, typename Value, bool AllowDefValues, typename KeyCompFunc>
914  const Value& value)
915 {
916  return data.insert(it, Entry(key, value));
917 }
918 
919 template <typename Key, typename Value, bool AllowDefValues, typename KeyCompFunc>
922 {
923  EntryIterator lb = data.lower_bound(item.first);
924  EntryIterator end = data.end();
925 
926  if (lb == end || data.key_comp()(item.first, (*lb).first))
927  return data.insert(lb, item);
928 
929  EntryIterator range_end = lb;
930 
931  while (range_end != end && !data.key_comp()(item.first, (*range_end).first))
932  ++range_end;
933 
934  data.erase(lb, range_end);
935 
936  return data.insert(range_end, item);
937 }
938 
939 template <typename Key, typename Value, bool AllowDefValues, typename KeyCompFunc>
942 {
943  return setEntry(Entry(key, value));
944 }
945 
946 template <typename Key, typename Value, bool AllowDefValues, typename KeyCompFunc>
947 template <typename InputIter>
949  const InputIter& last)
950 {
951  data.insert(first, last);
952 }
953 
954 template <typename Key, typename Value, bool AllowDefValues, typename KeyCompFunc>
955 template <typename InputIter>
957  const InputIter& last)
958 {
959  for (InputIter it = first; it != last; ++it)
960  setEntry(*it);
961 }
962 
963 template <typename Key, typename Value, bool AllowDefValues, typename KeyCompFunc>
966 {
967  return data.lower_bound(key);
968 }
969 
970 template <typename Key, typename Value, bool AllowDefValues, typename KeyCompFunc>
973 {
974  return data.lower_bound(key);
975 }
976 
977 template <typename Key, typename Value, bool AllowDefValues, typename KeyCompFunc>
980 {
981  return data.upper_bound(key);
982 }
983 
984 template <typename Key, typename Value, bool AllowDefValues, typename KeyCompFunc>
987 {
988  return data.upper_bound(key);
989 }
990 
991 template <typename Key, typename Value, bool AllowDefValues, typename KeyCompFunc>
994 {
995  return data.begin();
996 }
997 
998 template <typename Key, typename Value, bool AllowDefValues, typename KeyCompFunc>
1001 {
1002  return data.begin();
1003 }
1004 
1005 template <typename Key, typename Value, bool AllowDefValues, typename KeyCompFunc>
1008 {
1009  return data.end();
1010 }
1011 
1012 template <typename Key, typename Value, bool AllowDefValues, typename KeyCompFunc>
1015 {
1016  return data.end();
1017 }
1018 
1019 template <typename Key, typename Value, bool AllowDefValues, typename KeyCompFunc>
1022 {
1023  return data.begin();
1024 }
1025 
1026 template <typename Key, typename Value, bool AllowDefValues, typename KeyCompFunc>
1029 {
1030  return data.begin();
1031 }
1032 
1033 template <typename Key, typename Value, bool AllowDefValues, typename KeyCompFunc>
1036 {
1037  return data.end();
1038 }
1039 
1040 template <typename Key, typename Value, bool AllowDefValues, typename KeyCompFunc>
1043 {
1044  return data.end();
1045 }
1046 
1047 template <typename Key, typename Value, bool AllowDefValues, typename KeyCompFunc>
1050 {
1051  return data.rbegin();
1052 }
1053 
1054 template <typename Key, typename Value, bool AllowDefValues, typename KeyCompFunc>
1057 {
1058  return data.rbegin();
1059 }
1060 
1061 template <typename Key, typename Value, bool AllowDefValues, typename KeyCompFunc>
1064 {
1065  return data.rend();
1066 }
1067 
1068 template <typename Key, typename Value, bool AllowDefValues, typename KeyCompFunc>
1071 {
1072  return data.rend();
1073 }
1074 
1075 template <typename Key, typename Value, bool AllowDefValues, typename KeyCompFunc>
1077 {
1078  return "MultiMap";
1079 }
1080 
1081 template <typename Key, typename Value, bool AllowDefValues, typename KeyCompFunc>
1083 {
1085 }
1086 
1087 // \cond DOC_IMPL_DETAILS
1088 
1089 template <typename Key, typename Value, bool AllowDefValues, typename KeyCompFunc>
1090 bool CDPL::Util::operator==(const MultiMap<Key, Value, AllowDefValues, KeyCompFunc>& map1,
1091  const MultiMap<Key, Value, AllowDefValues, KeyCompFunc>& map2)
1092 {
1093  return (map1.getData() == map2.getData());
1094 }
1095 
1096 template <typename Key, typename Value, bool AllowDefValues, typename KeyCompFunc>
1097 bool CDPL::Util::operator!=(const MultiMap<Key, Value, AllowDefValues, KeyCompFunc>& map1,
1098  const MultiMap<Key, Value, AllowDefValues, KeyCompFunc>& map2)
1099 {
1100  return (map1.getData() != map2.getData());
1101 }
1102 
1103 template <typename Key, typename Value, bool AllowDefValues, typename KeyCompFunc>
1104 bool CDPL::Util::operator<=(const MultiMap<Key, Value, AllowDefValues, KeyCompFunc>& map1,
1105  const MultiMap<Key, Value, AllowDefValues, KeyCompFunc>& map2)
1106 {
1107  return (map1.getData() <= map2.getData());
1108 }
1109 
1110 template <typename Key, typename Value, bool AllowDefValues, typename KeyCompFunc>
1111 bool CDPL::Util::operator>=(const MultiMap<Key, Value, AllowDefValues, KeyCompFunc>& map1,
1112  const MultiMap<Key, Value, AllowDefValues, KeyCompFunc>& map2)
1113 {
1114  return (map1.getData() >= map2.getData());
1115 }
1116 
1117 template <typename Key, typename Value, bool AllowDefValues, typename KeyCompFunc>
1118 bool CDPL::Util::operator<(const MultiMap<Key, Value, AllowDefValues, KeyCompFunc>& map1,
1119  const MultiMap<Key, Value, AllowDefValues, KeyCompFunc>& map2)
1120 {
1121  return (map1.getData() < map2.getData());
1122 }
1123 
1124 template <typename Key, typename Value, bool AllowDefValues, typename KeyCompFunc>
1125 bool CDPL::Util::operator>(const MultiMap<Key, Value, AllowDefValues, KeyCompFunc>& map1,
1126  const MultiMap<Key, Value, AllowDefValues, KeyCompFunc>& map2)
1127 {
1128  return (map1.getData() > map2.getData());
1129 }
1130 
1131 // \endcond
1132 
1133 #endif // CDPL_UTIL_MULTIMAP_HPP
Definition of exception classes.
Thrown to indicate that some requested data item could not be found.
Definition: Base/Exceptions.hpp:171
Thrown to indicate that some requested operation has failed (e.g. due to unfulfilled preconditions or...
Definition: Base/Exceptions.hpp:211
A multiple sorted associative container that maps keys to values.
Definition: MultiMap.hpp:96
Key KeyType
The type of the map's keys.
Definition: MultiMap.hpp:109
ConstEntryIterator getEntriesEnd() const
Returns a constant iterator pointing to the end of the map.
Definition: MultiMap.hpp:1007
void swap(MultiMap &map)
Swaps the contents with map.
Definition: MultiMap.hpp:749
EntryIterator insertEntry(const EntryIterator &it, const Entry &item)
Inserts the key/value pair item into the map and uses the iterator it as a hint for the insertion loc...
Definition: MultiMap.hpp:906
ConstReverseEntryIterator getEntriesReverseEnd() const
Returns a constant iterator pointing to the end of the reversed map.
Definition: MultiMap.hpp:1063
void removeEntries(const EntryIterator &first, const EntryIterator &last)
Removes all entries pointed to by the iterators in the range [first, last) from the map.
Definition: MultiMap.hpp:884
std::pair< EntryIterator, EntryIterator > EntryIteratorRange
A pair of mutable iterators used to specify the start and end of a range of entries.
Definition: MultiMap.hpp:147
virtual ~MultiMap()
Virtual destructor.
Definition: MultiMap.hpp:192
EntryIterator insertEntry(const Key &key, const Value &value)
Inserts a new entry with specified key and value into the map.
Definition: MultiMap.hpp:899
const Value & getValue(const Key &key) const
Returns a const reference to the first value associated with the specified key.
Definition: MultiMap.hpp:821
const Value & operator[](const Key &key) const
Returns a const reference to the first value associated with the specified key.
Definition: MultiMap.hpp:854
ConstEntryIterator getUpperBound(const Key &key) const
Returns a constant iterator pointing to the first entry whose key is greater than key.
Definition: MultiMap.hpp:986
EntryIterator setEntry(const Entry &item)
Replaces all entries with a key equivalent to that of item with a single entry specified by item.
Definition: MultiMap.hpp:921
const StorageType & getData() const
Returns a const reference to the underlying map storage.
Definition: MultiMap.hpp:725
StorageType::iterator EntryIterator
A mutable iterator used to iterate over the entries of the map.
Definition: MultiMap.hpp:137
void setEntries(const InputIter &first, const InputIter &last)
Inserts new entries or updates the value of existing entries using the key/value pairs in the range [...
Definition: MultiMap.hpp:956
EntryIterator getLowerBound(const Key &key)
Returns a mutable iterator pointing to the first entry whose key is not less than key.
Definition: MultiMap.hpp:965
std::size_t getNumEntries(const Key &key) const
Returns the number of entries with the specified key.
Definition: MultiMap.hpp:761
EntryIterator getUpperBound(const Key &key)
Returns a mutable iterator pointing to the first entry whose key is greater than key.
Definition: MultiMap.hpp:979
ConstReverseEntryIterator getEntriesReverseBegin() const
Returns a constant iterator pointing to the beginning of the reversed map.
Definition: MultiMap.hpp:1049
MultiMap(const InputIter &first, const InputIter &last)
Creates and initializes the map with copies of the key value pairs in the range [first,...
Definition: MultiMap.hpp:173
EntryIterator insertEntry(const EntryIterator &it, const Key &key, const Value &value)
Inserts a new entry with the specified key and value into the map and uses the iterator it as a hint ...
Definition: MultiMap.hpp:913
EntryIterator setEntry(const Key &key, const Value &value)
Replaces all entries with a key equivalent to key with a single copy of the key/value pair (key,...
Definition: MultiMap.hpp:941
Value & getValue(const Key &key)
Returns a non-const reference to the first value associated with the specified key.
Definition: MultiMap.hpp:795
EntryIterator insertEntry(const Entry &item)
Inserts the key/value pair item into the map.
Definition: MultiMap.hpp:892
void removeEntry(const EntryIterator &it)
Removes the entry pointed to by the iterator it from the map.
Definition: MultiMap.hpp:860
StorageType::value_type Entry
The type of the key/value pairs stored in the map.
Definition: MultiMap.hpp:122
ConstEntryIterator getEntry(const Key &key) const
Returns a constant iterator pointing to the first entry with the specified key.
Definition: MultiMap.hpp:775
EntryIterator end()
Returns a mutable iterator pointing to the end of the map.
Definition: MultiMap.hpp:1042
MultiMap(const KeyCompFunc &func)
Creates an empty map and uses func as key compare function.
Definition: MultiMap.hpp:164
MultiMap()
Creates an empty map.
Definition: MultiMap.hpp:157
Value ValueType
The type of the mapped values.
Definition: MultiMap.hpp:114
std::pair< ConstEntryIterator, ConstEntryIterator > ConstEntryIteratorRange
A pair of constant iterators used to specify the start and end of a range of entries.
Definition: MultiMap.hpp:152
Value & getValue(const Key &key, Value &def_value)
Returns a non-const reference to the first value associated with the specified key,...
Definition: MultiMap.hpp:810
void insertEntries(const InputIter &first, const InputIter &last)
Inserts the key/value pairs in the range [first, last) into the map.
Definition: MultiMap.hpp:948
std::size_t getSize() const
Returns the size (number of entries) of the map.
Definition: MultiMap.hpp:731
ReverseEntryIterator getEntriesReverseEnd()
Returns a mutable iterator pointing to the end of the reversed map.
Definition: MultiMap.hpp:1070
ReverseEntryIterator getEntriesReverseBegin()
Returns a mutable iterator pointing to the beginning of the reversed map.
Definition: MultiMap.hpp:1056
std::size_t removeEntries(const Key &key)
Removes all entries with the specified key from the map.
Definition: MultiMap.hpp:878
StorageType & getData()
Returns a non-const reference to the underlying map storage.
Definition: MultiMap.hpp:718
ConstEntryIteratorRange getEntries(const Key &key) const
Returns the bounds of a range that includes all entries with a key that compares equal to the specifi...
Definition: MultiMap.hpp:789
StorageType::const_reverse_iterator ConstReverseEntryIterator
A constant iterator used to iterate backwards over the entries of the map.
Definition: MultiMap.hpp:132
MultiMap(const InputIter &first, const InputIter &last, const KeyCompFunc &func)
Creates and initializes the map with copies of the key value pairs in the range [first,...
Definition: MultiMap.hpp:185
std::shared_ptr< MultiMap > SharedPointer
A reference-counted smart pointer [SHPTR] for dynamically allocated MultiMap instances.
Definition: MultiMap.hpp:104
bool removeEntry(const Key &key)
Removes the first entry with the specified key from the map.
Definition: MultiMap.hpp:866
ConstEntryIterator begin() const
Returns a constant iterator pointing to the beginning of the map.
Definition: MultiMap.hpp:1021
KeyCompFunc getKeyCompareFunction() const
Returns the key compare function used by the map.
Definition: MultiMap.hpp:755
EntryIteratorRange getEntries(const Key &key)
Returns the bounds of a range that includes all entries with a key that compares equal to the specifi...
Definition: MultiMap.hpp:782
virtual const char * getClassName() const
Returns the name of the (derived) Map class.
Definition: MultiMap.hpp:1076
bool isEmpty() const
Tells whether the map is empty (getSize() == 0).
Definition: MultiMap.hpp:737
ConstEntryIterator getEntriesBegin() const
Returns a constant iterator pointing to the beginning of the map.
Definition: MultiMap.hpp:993
EntryIterator begin()
Returns a mutable iterator pointing to the beginning of the map.
Definition: MultiMap.hpp:1028
StorageType::reverse_iterator ReverseEntryIterator
A mutable iterator used to iterate backwards over the entries of the map.
Definition: MultiMap.hpp:142
ConstEntryIterator getLowerBound(const Key &key) const
Returns a constant iterator pointing to the first entry whose key is not less than key.
Definition: MultiMap.hpp:972
Value & operator[](const Key &key)
Returns a non-const reference to the first value associated with the specified key.
Definition: MultiMap.hpp:848
EntryIterator getEntriesEnd()
Returns a mutable iterator pointing to the end of the map.
Definition: MultiMap.hpp:1014
const Value & getValue(const Key &key, const Value &def_value) const
Returns a const reference to the first value associated with the specified key, or the value given by...
Definition: MultiMap.hpp:836
ConstEntryIterator end() const
Returns a constant iterator pointing to the end of the map.
Definition: MultiMap.hpp:1035
StorageType::const_iterator ConstEntryIterator
A constant iterator used to iterate over the entries of the map.
Definition: MultiMap.hpp:127
void clear()
Erases all entries.
Definition: MultiMap.hpp:743
EntryIterator getEntry(const Key &key)
Returns a mutable iterator pointing to the first entry with the specified key.
Definition: MultiMap.hpp:768
EntryIterator getEntriesBegin()
Returns a mutable iterator pointing to the beginning of the map.
Definition: MultiMap.hpp:1000
bool operator<(const Array< ValueType > &array1, const Array< ValueType > &array2)
Less than comparison operator.
bool operator>=(const Array< ValueType > &array1, const Array< ValueType > &array2)
Greater or equal comparison operator.
bool operator>(const Array< ValueType > &array1, const Array< ValueType > &array2)
Greater than comparison operator.
bool operator!=(const Array< ValueType > &array1, const Array< ValueType > &array2)
Inequality comparison operator.
bool operator<=(const Array< ValueType > &array1, const Array< ValueType > &array2)
Less or equal comparison operator.
bool operator==(const Array< ValueType > &array1, const Array< ValueType > &array2)
Equality comparison operator.
The namespace of the Chemical Data Processing Library.
static const ValueType & get()
Definition: MultiMap.hpp:67
Definition: MultiMap.hpp:50
static const ValueType & get()
Definition: MultiMap.hpp:52
static const ValueType defValue
Definition: MultiMap.hpp:57