24 const std::list<std::string>& names =
25 option_definitions_.getOptionSpaceNames();
26 for (std::list<std::string>::const_iterator name = names.begin();
27 name != names.end(); ++name) {
29 for (OptionDefContainer::const_iterator def = defs->begin();
30 def != defs->end(); ++def) {
33 new_config.
add(new_def, *name);
41 const std::list<std::string>& names = option_definitions_.getOptionSpaceNames();
43 const std::list<std::string>&
47 if (names.size() != other_names.size()) {
52 for (std::list<std::string>::const_iterator name = names.begin();
53 name != names.end(); ++name) {
59 if (defs->size() != defs->size()) {
63 for (OptionDefContainer::const_iterator def = defs->begin();
64 def != defs->end(); ++def) {
66 other_def = other.
get(*name, (*def)->getCode());
68 if (!other_def || (*other_def != **def)) {
80 const std::string& option_space) {
81 if (!OptionSpace::validateName(option_space)) {
83 << option_space <<
"'");
88 "option definition must not be NULL");
90 }
else if (get(option_space, def->getCode())) {
92 << def->getCode() <<
"' already exists in option"
93 " space '" << option_space <<
"'");
96 }
else if (LibDHCP::getOptionDef(option_space, def->getCode())) {
98 << def->getCode() <<
"' in standard option space '"
99 << option_space <<
"'");
102 option_definitions_.addItem(def, option_space);
106 CfgOptionDef::getAll(
const std::string& option_space)
const {
108 return (option_definitions_.getItems(option_space));
112 CfgOptionDef::get(
const std::string& option_space,
113 const uint16_t option_code)
const {
119 if (defs && !defs->empty()) {
125 if (std::distance(range.first, range.second) > 0) {
126 return (*range.first);
134 CfgOptionDef::get(
const std::string& option_space,
135 const std::string& option_name)
const {
141 if (defs && !defs->empty()) {
147 if (std::distance(range.first, range.second) > 0) {
148 return (*range.first);
156 CfgOptionDef::toElement()
const {
160 const std::list<std::string>& names =
161 option_definitions_.getOptionSpaceNames();
162 for (std::list<std::string>::const_iterator name = names.begin();
163 name != names.end(); ++name) {
165 for (OptionDefContainer::const_iterator def = defs->begin();
166 def != defs->end(); ++def) {
170 (*def)->contextToElement(map);
176 std::string data_type =
177 OptionDataTypeUtil::getDataTypeName((*def)->getType());
180 bool array_type = (*def)->getArrayType();
183 std::string encapsulates = (*def)->getEncapsulatedSpace();
187 (*def)->getRecordFields();
188 if (!fields.empty()) {
189 std::ostringstream oss;
190 for (OptionDefinition::RecordFieldsCollection::const_iterator
191 field = fields.begin();
192 field != fields.end(); ++field) {
193 if (field != fields.begin()) {
196 oss << OptionDataTypeUtil::getDataTypeName(*field);