33 #include "dcmtk/config/osconfig.h"
35 #if defined(HAVE_STL) || defined(HAVE_STL_MAP)
39 #define OFMap std::map
40 #define OFPair std::pair
41 #define OFMake_pair std::make_pair
44 #include "dcmtk/ofstd/oftypes.h"
45 #include "dcmtk/ofstd/ofcast.h"
46 #include "dcmtk/ofstd/oflist.h"
48 #ifndef HAVE_CLASS_TEMPLATE
49 #error Your C++ compiler cannot handle class templates:
55 template<
typename K,
typename V>
class OFPair
89 template<
typename K,
typename V>
90 OFPair<K, V> OFMake_pair(
const K& first,
const V& second)
97 template<
typename K,
typename V>
class OFMap
129 for (const_iterator it = other.
begin();
130 it != other.
end(); it++)
144 iterator it =
find(key);
179 iterator it =
begin();
182 if (it->first == key)
194 const_iterator
find(
const K& key)
const
196 const_iterator it =
begin();
199 if (it->first == key)
219 void erase(
const iterator& first,
const iterator& last)
237 iterator it =
find(key);
256 return OFMake_pair(it,
false);
259 return OFMake_pair(it,
true);
OFPair & operator=(const OFPair &other)
copy assignment operator
OFPair()
default constructor
associative container class.
typedef OFListConstIterator(value_type) const _iterator
constant iterator class for OFMap.
OFPair(const K &f, const V &s)
construct a OFPair for the two given values
a pair - this implements parts of std::pair's interface.
OFPair< iterator, bool > insert(const value_type &val)
inserts a new element into the map, but does not overwrite existing elements
iterator begin()
returns iterator pointing to the first element of this map
OFList< value_type > values_
K first
this is the first value of the pair
void clear()
removes all elements from this map
int erase(const K &key)
removes the element with the given key from this map
const_iterator begin() const
returns constant iterator pointing to the first element of this map
void erase(const iterator &first, const iterator &last)
removes all elements in the given range from this map
OFPair< K, V > value_type
the type of values saved in this map
OFMap & operator=(const OFMap &other)
copy constructor
iterator end()
returns iterator pointer after the last element of this map
double linked list template class.
V & operator[](const K &key)
index operator.
iterator find(const K &key)
looks up the given key in this map
V second
this is the second value of the pair
size_t size() const
returns the number of elements saved in this map
void erase(const iterator &elem)
removes the element to which the given iterator points to
const_iterator find(const K &key) const
looks up the given key in this map
const_iterator end() const
returns constant iterator pointer after the last element of this map
typedef OFListIterator(value_type) iterator
iterator class for OFMap.