@@ -697,7 +697,7 @@ class Configuration {
697
697
: configMap_(std::move(otr.configMap_)),
698
698
valueMap_ (std::move(otr.valueMap_)) {} // move ctor
699
699
700
- // virtual destructor set to that pybind11 recognizes attributes inheritance
700
+ // virtual destructor set so that pybind11 recognizes attributes inheritance
701
701
// from Configuration to be polymorphic
702
702
virtual ~Configuration () = default ;
703
703
@@ -1163,7 +1163,8 @@ class Configuration {
1163
1163
* @param desiredType the @ref ConfigValType to compare the value's type to
1164
1164
* @return Whether @p key references a value that is of @p desiredType.
1165
1165
*/
1166
- bool hasKeyOfType (const std::string& key, ConfigValType desiredType) {
1166
+ bool hasKeyToValOfType (const std::string& key,
1167
+ ConfigValType desiredType) const {
1167
1168
ValueMapType::const_iterator mapIter = valueMap_.find (key);
1168
1169
return (mapIter != valueMap_.end () &&
1169
1170
(mapIter->second .getType () == desiredType));
@@ -1247,7 +1248,6 @@ class Configuration {
1247
1248
* @return A pointer to a copy of the Configuration having the requested
1248
1249
* name, cast to the appropriate type, or nullptr if not found.
1249
1250
*/
1250
-
1251
1251
template <typename T>
1252
1252
std::shared_ptr<T> getSubconfigCopy (const std::string& cfgName) const {
1253
1253
static_assert (std::is_base_of<Configuration, T>::value,
@@ -1371,27 +1371,24 @@ class Configuration {
1371
1371
1372
1372
/* *
1373
1373
* @brief Merges Configuration pointed to by @p src into this
1374
- * Configuration, including all subconfigs. Passed config overwrites
1374
+ * Configuration, including all subconfigs. Passed config overwrites
1375
1375
* existing data in this config.
1376
1376
* @param src The source of Configuration data we wish to merge into this
1377
1377
* Configuration.
1378
1378
*/
1379
- void overwriteWithConfig (const std::shared_ptr<const Configuration>& src) {
1380
- if (src->getNumEntries () == 0 ) {
1381
- return ;
1382
- }
1383
- // copy every element over from src
1384
- for (const auto & elem : src->valueMap_ ) {
1385
- valueMap_[elem.first ] = elem.second ;
1386
- }
1387
- // merge subconfigs
1388
- for (const auto & subConfig : src->configMap_ ) {
1389
- const auto name = subConfig.first ;
1390
- // make if DNE and merge src subconfig
1391
- addOrEditSubgroup<Configuration>(name).first ->second ->overwriteWithConfig (
1392
- subConfig.second );
1393
- }
1394
- }
1379
+ void overwriteWithConfig (const std::shared_ptr<const Configuration>& src);
1380
+
1381
+ /* *
1382
+ * @brief Performs the opposite operation to @ref Configuration::overwriteWithConfig.
1383
+ * All values and subconfigs in the passed Configuration will be removed from
1384
+ * this config unless the data they hold is different. Any empty subconfigs
1385
+ * will be removed as well.
1386
+ *
1387
+ * @param src The source of Configuration data we wish to prune from this
1388
+ * Configuration.
1389
+ */
1390
+
1391
+ void filterFromConfig (const std::shared_ptr<const Configuration>& src);
1395
1392
1396
1393
/* *
1397
1394
* @brief Returns a const iterator across the map of values.
0 commit comments