// This is a way to convert ConstElementPtr to ElementPtr.
// We need a config that can be edited, because we will insert
// default values and will insert derived values as well.
- std::map<std::string, ConstElementPtr> values;
- config_set->getValue(values);
- ElementPtr mutable_cfg(new MapElement());
- mutable_cfg->setValue(values);
+ ElementPtr mutable_cfg = Element::getMutableMap(config_set);
// Set all default values if not specified by the user.
SimpleParser4::setAllDefaults(mutable_cfg);
// This is a way to convert ConstElementPtr to ElementPtr.
// We need a config that can be edited, because we will insert
// default values and will insert derived values as well.
- std::map<std::string, ConstElementPtr> values;
- config_set->getValue(values);
- ElementPtr mutable_cfg(new MapElement());
- mutable_cfg->setValue(values);
+ ElementPtr mutable_cfg = Element::getMutableMap(config_set);
SimpleParser6::setAllDefaults(mutable_cfg);
subnet_parser = parser;
} else if (config_pair.first == "lease-database") {
leases_parser = parser;
- } /* else if (config_pair.first == "option-data") {
- option_parser = parser;
- } */ else if (config_pair.first == "hooks-libraries") {
+ } else if (config_pair.first == "hooks-libraries") {
// Executing the commit will alter currently loaded hooks
// libraries. Check if the supplied libraries are valid,
// but defer the commit until after everything else has
}
}
+ElementPtr Element::getMutableMap(ConstElementPtr& const_map) {
+ std::map<std::string, ConstElementPtr> values;
+ const_map->getValue(values);
+ ElementPtr mutable_map(new MapElement());
+ mutable_map->setValue(values);
+
+ return (mutable_map);
+}
+
}
}
/// \return ElementPtr with the data that is parsed.
static ElementPtr fromWire(const std::string& s);
//@}
+
+ /// @brief Creates mutable map based on const map
+ ///
+ /// @param const_map const map to be used as a donor
+ /// @return mutable map
+ static ElementPtr getMutableMap(ConstElementPtr& const_map);
};
/// Notes: IntElement type is changed to int64_t.