@@ -69,64 +69,41 @@ class config_registry {
6969 std::vector<std::string> get_sources () const ;
7070
7171 /* *
72- * @brief Gets default value for non-integer types
72+ * @brief Gets default value
7373 * @tparam T Value type
7474 * @param key Configuration parameter key
7575 * @return Default value for the parameter
7676 */
77- template <typename T>
78- typename std::enable_if<!is_integer<T>::value, T>::type get_default_value (
79- const std::string &key) const
80- {
81- return get_value_impl<T>(
82- key, [this ](const std::string &k) { return get_default_value_as_any (k); });
83- }
84-
85- /* *
86- * @brief Gets default value for integer types with bounds checking
87- * @tparam T Integer type
88- * @param key Configuration parameter key
89- * @return Default value for the parameter
90- * @note For enums, use int instead since C++14 doesn't support bound checking for enums
91- */
92- template <typename T>
93- typename std::enable_if<is_integer<T>::value, T>::type get_default_value (
94- const std::string &key) const
77+ template <typename T> T get_default_value (const std::string &key) const
9578 {
9679 return get_value_impl<T>(
9780 key, [this ](const std::string &k) { return get_default_value_as_any (k); });
9881 }
9982
10083 /* *
101- * @brief Gets configured value for non- integer types
84+ * @brief Gets configured value. For integer types, also does bounds checking
10285 * @tparam T Value type
10386 * @param key Configuration parameter key
10487 * @return Current value for the parameter
10588 */
106- template <typename T>
107- typename std::enable_if<!is_integer<T>::value, T>::type get_value (const std::string &key) const
89+ template <typename T> T get_value (const std::string &key) const
10890 {
10991 return get_value_impl<T>(key, [this ](const std::string &k) { return get_value_as_any (k); });
11092 }
11193
11294 /* *
113- * @brief Gets configured value for integer types with bounds checking
114- * @tparam T Integer type
95+ * @brief Gets configured value as any
11596 * @param key Configuration parameter key
116- * @return Current value for the parameter
117- * @note For enums, use int instead since C++14 doesn't support bound checking for enums
97+ * @return Current value for the parameter, as any
11898 */
119- template <typename T>
120- typename std::enable_if<is_integer<T>::value, T>::type get_value (const std::string &key) const
121- {
122- return get_value_impl<T>(key, [this ](const std::string &k) { return get_value_as_any (k); });
123- }
99+ std::experimental::any get_value_as_any (const std::string &key) const ;
100+
101+ const config_descriptor &get_config_descriptor () const { return m_config_descriptor; }
124102
125103private:
126104 std::map<std::string, std::experimental::any> m_config_data;
127105 config_descriptor m_config_descriptor;
128106 std::vector<std::string> m_sources;
129- std::experimental::any get_value_as_any (const std::string &key) const ;
130107 std::experimental::any get_default_value_as_any (const std::string &key) const ;
131108 void initialize_registry (std::queue<std::unique_ptr<loader>> &&value_loaders,
132109 std::unique_ptr<descriptor_provider> descriptor_provider);
0 commit comments