11 #include <boost/foreach.hpp> 12 #include <boost/lexical_cast.hpp> 28 "missing parameter '" << name <<
"' (" 29 << scope->getPosition() <<
")");
31 if (x->getType() != Element::string) {
33 "invalid type specified for parameter '" << name
34 <<
"' (" << x->getPosition() <<
")");
37 return (x->stringValue());
45 "missing parameter '" << name <<
"' (" 46 << scope->getPosition() <<
")");
48 if (x->getType() != Element::integer) {
50 "invalid type specified for parameter '" << name
51 <<
"' (" << x->getPosition() <<
")");
54 return (x->intValue());
62 "missing parameter '" << name <<
"' (" 63 << scope->getPosition() <<
")");
65 if (x->getType() != Element::boolean) {
67 "invalid type specified for parameter '" << name
68 <<
"' (" << x->getPosition() <<
")");
71 return (x->boolValue());
76 const std::string& name) {
77 std::string str = getString(scope, name);
80 }
catch (
const std::exception& e) {
82 <<
"' to address: " << e.
what() <<
"(" 83 << getPosition(name, scope) <<
")");
90 return (data::Element::ZERO_POSITION());
94 return (parent->getPosition());
96 return (elem->getPosition());
121 switch (def_value.
type_) {
122 case Element::string: {
126 case Element::integer: {
128 int int_value = boost::lexical_cast<int>(def_value.
value_);
131 catch (
const std::exception& ex) {
133 << def_value.
name_ <<
", value is: " 139 case Element::boolean: {
141 if (def_value.
value_ ==
string(
"true")) {
143 }
else if (def_value.
value_ ==
string(
"false")) {
147 "Internal error. Boolean value specified as " 148 << def_value.
value_ <<
", expected true or false");
153 case Element::real: {
154 double dbl_value = boost::lexical_cast<double>(def_value.
value_);
161 "Internal error. Incorrect default value type.");
165 scope->set(def_value.
name_, x);
176 BOOST_FOREACH(
ElementPtr entry, list->listValue()) {
177 cnt += setDefaults(entry, default_values);
186 if ( (parent->getType() != Element::map) ||
187 (child->getType() != Element::map)) {
192 BOOST_FOREACH(
string param, params) {
200 if (child->get(param)) {
207 child->set(param, x);
std::vector< SimpleDefault > SimpleDefaults
This specifies all default values in a given scope (e.g. a subnet)
boost::shared_ptr< Element > ElementPtr
virtual const char * what() const
Returns a C-style character string of the cause of the exception.
const isc::data::Element::types type_
#define isc_throw(type, stream)
A shortcut macro to insert known values into exception arguments.
A generic exception that is thrown if a parameter given to a method is considered invalid in that con...
To be removed. Please use ConfigError instead.
Notes: IntElement type is changed to int64_t.
boost::shared_ptr< const Element > ConstElementPtr
This array defines a single entry of default values.
Represents the position of the data element within a configuration string.
Defines the logger used by the top-level component of kea-dhcp-ddns.
std::vector< std::string > ParamsList
This defines a list of all parameters that are derived (or inherited) between contexts.
The IOAddress class represents an IP addresses (version agnostic)