2 #ifndef HUGO_MAPSKELETON_H
3 #define HUGO_MAPSKELETON_H
7 ///\brief Map concepts checking classes for testing and documenting.
11 /// The namespace of HUGOlib concepts and concept checking classes
14 /// \addtogroup skeletons
17 /// Readable map concept
18 template<typename K, typename T>
24 /// Map's value type. (The type of objects associated with the keys).
27 /// Returns the value associated with a key.
28 ValueType operator[](const KeyType &k) const {return ValueType();}
30 ///Default constructor
35 /// Writable map concept
36 template<typename K, typename T>
42 /// Map's value type. (The type of objects associated with the keys).
45 /// Sets the value associated with a key.
46 void set(const KeyType &k,const ValueType &t) {}
48 ///Default constructor
52 ///Read/Writable map concept
53 template<typename K, typename T>
54 class ReadWriteMap : public ReadMap<K,T>,
60 /// Map's value type. (The type of objects associated with the keys).
63 /// Returns the value associated with a key.
64 ValueType operator[](const KeyType &k) const {return ValueType();}
65 /// Sets the value associated with a key.
66 void set(const KeyType &k,const ValueType &t) {}
68 ///Default constructor
73 ///Dereferable map concept
74 template<typename K, typename T>
75 class ReferenceMap : public ReadWriteMap<K,T>
80 /// Map's value type. (The type of objects associated with the keys).
86 typedef ValueType& ReferenceType;
87 /// Map's const reference type.
88 typedef const ValueType& ConstReferenceType;
90 ///Returns a reference to the value associated to a key.
91 ReferenceType operator[](const KeyType &i) { return tmp; }
92 ///Returns a const reference to the value associated to a key.
93 ConstReferenceType operator[](const KeyType &i) const
95 /// Sets the value associated with a key.
96 void set(const KeyType &k,const ValueType &t) { operator[](k)=t; }
98 ///Default constructor
104 } //namespace skeleton
106 #endif // HUGO_MAPSKELETON_H