// -*- c++ -*- #ifndef HUGO_MAPSKELETON_H #define HUGO_MAPSKELETON_H ///\file ///\brief Map concepts checking classes for testing and documenting. namespace hugo { ///Readable map skeleton template class ReadMapSkeleton { public: /// Map value type. typedef T ValueType; /// Map key type. typedef K KeyType; ///Default constructor. ReadMapSkeleton() {} ///Reads an element of the map. ValueType operator[](const KeyType &i) const {return ValueType();} }; ///Writeable map skeleton template class WriteMapSkeleton { public: /// Map value type. typedef T ValueType; /// Map key type. typedef K KeyType; ///Default constructor. WriteMapSkeleton() {} ///'Fill with' constructor. WriteMapSkeleton(const ValueType &t) {} ///Write an element of a map. void set(const KeyType &i,const ValueType &t) {} }; ///Read/Write map skeleton. template class ReadWriteMapSkeleton : public ReadMapSkeleton, public WriteMapSkeleton { public: ///Default constructor. ReadWriteMapSkeleton() : ReadMapSkeleton(), WriteMapSkeleton() {} ///'Fill with' constructor. ReadWriteMap(const ValueType &t) :ReadMapSkeleton(), WriteMapSkeleton(t) {} }; ///Dereferable map skeleton template class MemoryMapSkeleton : public ReadWriteMapSkeleton { public: /// Map value type. typedef T ValueType; /// Map key type. typedef K KeyType; ///Default constructor. ReferenceMapSkeleton() : ReadWriteMapSkeleton() {} ///'Fill with' constructor. ReferenceMapSkeleton(const ValueType &t) : ReadWriteMapSkeleton(t) {} ///Give a reference to the value belonging to a key. ValueType &operator[](const KeyType &i) {return *(ValueType*)0;} ///Give a const reference to the value belonging to a key. const ValueType &operator[](const KeyType &i) const {return *(T*)0;} }; } #endif // HUGO_MAPSKELETON_H