| 2050 | |
| 2051 | template <typename Conf_T> |
| 2052 | void setValue(Level level, const Conf_T& value, std::map<Level, Conf_T>* confMap, bool includeGlobalLevel = true) { |
| 2053 | // If map is empty and we are allowed to add into generic level (Level::Global), do it! |
| 2054 | if (confMap->empty() && includeGlobalLevel) { |
| 2055 | confMap->insert(std::make_pair(Level::Global, value)); |
| 2056 | return; |
| 2057 | } |
| 2058 | // If same value exist in generic level already, dont add it to explicit level |
| 2059 | typename std::map<Level, Conf_T>::iterator it = confMap->find(Level::Global); |
| 2060 | if (it != confMap->end() && it->second == value) { |
| 2061 | return; |
| 2062 | } |
| 2063 | // Now make sure we dont double up values if we really need to add it to explicit level |
| 2064 | it = confMap->find(level); |
| 2065 | if (it == confMap->end()) { |
| 2066 | // Value not found for level, add new |
| 2067 | confMap->insert(std::make_pair(level, value)); |
| 2068 | } else { |
| 2069 | // Value found, just update value |
| 2070 | confMap->at(level) = value; |
| 2071 | } |
| 2072 | } |
| 2073 | |
| 2074 | void build(Configurations* configurations); |
| 2075 | unsigned long getULong(std::string confVal); |