Copyright header added.
2 * src/hugo/skeletons/maps.h - Part of HUGOlib, a generic C++ optimization library
4 * Copyright (C) 2004 Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport
5 * (Egervary Combinatorial Optimization Research Group, EGRES).
7 * Permission to use, modify and distribute this software is granted
8 * provided that this copyright notice appears in all copies. For
9 * precise terms see the accompanying LICENSE file.
11 * This software is provided "AS IS" with no warranty of any kind,
12 * express or implied, and with no claim as to its suitability for any
17 #ifndef HUGO_MAPSKELETON_H
18 #define HUGO_MAPSKELETON_H
22 ///\brief Map concepts checking classes for testing and documenting.
28 /// \addtogroup skeletons
31 /// Readable map concept
32 template<typename K, typename T>
38 /// Map's value type. (The type of objects associated with the keys).
41 /// Returns the value associated with a key.
42 ValueType operator[](const KeyType &k) const {return ValueType();}
44 ///Default constructor
49 /// Writable map concept
50 template<typename K, typename T>
56 /// Map's value type. (The type of objects associated with the keys).
59 /// Sets the value associated with a key.
60 void set(const KeyType &k,const ValueType &t) {}
62 ///Default constructor
66 ///Read/Writable map concept
67 template<typename K, typename T>
68 class ReadWriteMap : public ReadMap<K,T>,
74 /// Map's value type. (The type of objects associated with the keys).
77 /// Returns the value associated with a key.
78 ValueType operator[](const KeyType &k) const {return ValueType();}
79 /// Sets the value associated with a key.
80 void set(const KeyType &k,const ValueType &t) {}
82 ///Default constructor
87 ///Dereferable map concept
88 template<typename K, typename T>
89 class ReferenceMap : public ReadWriteMap<K,T>
94 /// Map's value type. (The type of objects associated with the keys).
100 typedef ValueType& ReferenceType;
101 /// Map's const reference type.
102 typedef const ValueType& ConstReferenceType;
104 ///Returns a reference to the value associated to a key.
105 ReferenceType operator[](const KeyType &i) { return tmp; }
106 ///Returns a const reference to the value associated to a key.
107 ConstReferenceType operator[](const KeyType &i) const
109 /// Sets the value associated with a key.
110 void set(const KeyType &k,const ValueType &t) { operator[](k)=t; }
112 ///Default constructor
118 } //namespace skeleton
120 #endif // HUGO_MAPSKELETON_H