File indexing completed on 2024-04-06 12:05:24
0001 #ifndef DD_READMAPTYPE_H
0002 #define DD_READMAPTYPE_H
0003
0004 #include <string>
0005 #include <map>
0006
0007 namespace dddDetails {
0008 void errorReadMapType(const std::string& key);
0009 }
0010
0011
0012
0013 template <class V>
0014 class ReadMapType : public std::map<std::string, V> {
0015 public:
0016 ReadMapType() : std::map<std::string, V>() {}
0017
0018 const V& operator[](const std::string& key) const {
0019 typename std::map<std::string, V>::const_iterator it = this->find(key);
0020 if (it == this->end())
0021 dddDetails::errorReadMapType(key);
0022 return it->second;
0023 }
0024
0025 V& operator[](const std::string& key) { return std::map<std::string, V>::operator[](key); }
0026 };
0027
0028 #endif