11#include <boost/foreach.hpp>
12#include <boost/lexical_cast.hpp>
28 "missing parameter '" << name <<
"' ("
29 << scope->getPosition() <<
")");
33 "invalid type specified for parameter '" << name
34 <<
"' (" << x->getPosition() <<
")");
37 return (x->stringValue());
45 "missing parameter '" << name <<
"' ("
46 << scope->getPosition() <<
")");
50 "invalid type specified for parameter '" << name
51 <<
"' (" << x->getPosition() <<
")");
54 return (x->intValue());
62 "missing parameter '" << name <<
"' ("
63 << scope->getPosition() <<
")");
67 "invalid type specified for parameter '" << name
68 <<
"' (" << x->getPosition() <<
")");
71 return (x->boolValue());
76 const std::string& name) {
80 }
catch (
const std::exception& e) {
82 <<
"' to address: " << e.
what() <<
"("
94 return (parent->getPosition());
96 return (elem->getPosition());
121 switch (def_value.
type_) {
128 int int_value = boost::lexical_cast<int>(def_value.
value_);
131 catch (
const std::exception& ex) {
133 << def_value.
name_ <<
", value is: "
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");
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()) {
192 BOOST_FOREACH(
string param, params) {
200 if (child->get(param)) {
207 child->set(param, x);
A generic exception that is thrown if a parameter given to a method is considered invalid in that con...
virtual const char * what() const
Returns a C-style character string of the cause of the exception.
The IOAddress class represents an IP addresses (version agnostic)
static const Position & ZERO_POSITION()
Returns Position object with line_ and pos_ set to 0, and with an empty file name.
Notes: IntElement type is changed to int64_t.
static size_t setListDefaults(isc::data::ConstElementPtr list, const SimpleDefaults &default_values)
Sets the default values for all entries in a list.
static const data::Element::Position & getPosition(const std::string &name, const data::ConstElementPtr parent)
Utility method that returns position of an element.
static isc::asiolink::IOAddress getAddress(const ConstElementPtr &scope, const std::string &name)
Returns a IOAddress parameter from a scope.
static std::string getString(isc::data::ConstElementPtr scope, const std::string &name)
Returns a string parameter from a scope.
static bool getBoolean(isc::data::ConstElementPtr scope, const std::string &name)
Returns a boolean parameter from a scope.
static size_t deriveParams(isc::data::ConstElementPtr parent, isc::data::ElementPtr child, const ParamsList ¶ms)
Derives (inherits) parameters from parent scope to a child.
static int64_t getInteger(isc::data::ConstElementPtr scope, const std::string &name)
Returns an integer parameter from a scope.
static size_t setDefaults(isc::data::ElementPtr scope, const SimpleDefaults &default_values)
Sets the default values.
To be removed. Please use ConfigError instead.
#define isc_throw(type, stream)
A shortcut macro to insert known values into exception arguments.
std::vector< std::string > ParamsList
This defines a list of all parameters that are derived (or inherited) between contexts.
boost::shared_ptr< const Element > ConstElementPtr
std::vector< SimpleDefault > SimpleDefaults
This specifies all default values in a given scope (e.g. a subnet)
boost::shared_ptr< Element > ElementPtr
Defines the logger used by the top-level component of kea-dhcp-ddns.
Represents the position of the data element within a configuration string.
This array defines a single entry of default values.
const isc::data::Element::types type_