2 #ifndef HUGO_MAPSKELETON_H
3 #define HUGO_MAPSKELETON_H
7 ///\brief Map concepts checking classes for testing and documenting.
13 /// \addtogroup skeletons
16 /// Readable map concept
17 template<typename K, typename T>
23 /// Map's value type. (The type of objects associated with the keys).
26 /// Returns the value associated with a key.
27 ValueType operator[](const KeyType &k) const {return ValueType();}
29 ///Default constructor
34 /// Writable map concept
35 template<typename K, typename T>
41 /// Map's value type. (The type of objects associated with the keys).
44 /// Sets the value associated with a key.
45 void set(const KeyType &k,const ValueType &t) {}
47 ///Default constructor
51 ///Read/Writable map concept
52 template<typename K, typename T>
53 class ReadWriteMap : public ReadMap<K,T>,
59 /// Map's value type. (The type of objects associated with the keys).
62 /// Returns the value associated with a key.
63 ValueType operator[](const KeyType &k) const {return ValueType();}
64 /// Sets the value associated with a key.
65 void set(const KeyType &k,const ValueType &t) {}
67 ///Default constructor
72 ///Dereferable map concept
73 template<typename K, typename T>
74 class ReferenceMap : public ReadWriteMap<K,T>
79 /// Map's value type. (The type of objects associated with the keys).
85 typedef ValueType& ReferenceType;
86 /// Map's const reference type.
87 typedef const ValueType& ConstReferenceType;
89 ///Returns a reference to the value associated to a key.
90 ReferenceType operator[](const KeyType &i) { return tmp; }
91 ///Returns a const reference to the value associated to a key.
92 ConstReferenceType operator[](const KeyType &i) const
94 /// Sets the value associated with a key.
95 void set(const KeyType &k,const ValueType &t) { operator[](k)=t; }
97 ///Default constructor
103 } //namespace skeleton
105 #endif // HUGO_MAPSKELETON_H