}
void
-CfgOption::merge(CfgOption& other) const {
+CfgOption::mergeTo(CfgOption& other) const {
// Merge non-vendor options.
mergeInternal(options_, other.options_);
// Merge vendor options.
}
void
-CfgOption::copy(CfgOption& other) const {
- // Create empty object and "merge" data to it.
- CfgOption new_cfg;
- merge(new_cfg);
- other = new_cfg;
+CfgOption::copyTo(CfgOption& other) const {
+ // Remove any existing data in the destination.
+ other.options_.clearItems();
+ other.vendor_options_.clearItems();
+ mergeTo(other);
}
void
/// copied.
///
/// @param [out] other Configuration object to merge to.
- void merge(CfgOption& other) const;
+ void mergeTo(CfgOption& other) const;
/// @brief Copies this configuration to another configuration.
///
/// This method copies options configuration to another object.
///
/// @param [out] other An object to copy the configuration to.
- void copy(CfgOption& other) const;
+ void copyTo(CfgOption& other) const;
/// @brief Appends encapsulated options to top-level options.
///
}
// Merge globally defined options to the subnet specific options.
- CfgMgr::instance().getStagingCfg()->getCfgOption()->merge(*options_);
+ CfgMgr::instance().getStagingCfg()->getCfgOption()->mergeTo(*options_);
// Copy all options to the subnet configuration.
- options_->copy(*subnet_->getCfgOption());
+ options_->copyTo(*subnet_->getCfgOption());
// Append suboptions to the top-level options.
subnet_->getCfgOption()->encapsulate();
}
new_config.setCfgIface(cfg_iface_);
// Replace option definitions.
cfg_option_def_->copyTo(*new_config.cfg_option_def_);
- cfg_option_->copy(*new_config.cfg_option_);
+ cfg_option_->copyTo(*new_config.cfg_option_);
}
void
// Merge source configuration to the destination configuration. The options
// in the destination should be preserved. The options from the source
// configuration should be added.
- ASSERT_NO_THROW(cfg_src.merge(cfg_dst));
+ ASSERT_NO_THROW(cfg_src.mergeTo(cfg_dst));
// Validate the options in the dhcp6 option space in the destination.
for (uint16_t code = 100; code < 110; ++code) {
// Copy entire configuration to the destination. This should override any
// existing data.
- ASSERT_NO_THROW(cfg_src.copy(cfg_dst));
+ ASSERT_NO_THROW(cfg_src.copyTo(cfg_dst));
// Validate options in the destination configuration.
for (uint16_t code = 100; code < 110; ++code) {