11#include <boost/lexical_cast.hpp> 
   51        switch (parameter_type) {
 
   63            if ((value != 
"0") && (value != 
"1")) {
 
   65                          << 
" specified as boolean. Expected \"0\" or \"1\"");
 
   80                      << 
" of the parameter '" << name);
 
   83    } 
catch (
const boost::bad_lexical_cast& ex) {
 
   87                  << 
"' can't be converted to " 
   92    return (stamped_value);
 
 
   99                  "type of the null value for the '" << name_
 
  103    return (value_->getType());
 
 
  113            return (value_->stringValue());
 
  115            return (boost::lexical_cast<std::string>(value_->intValue()));
 
  117            return (value_->boolValue() ? 
"1" : 
"0");
 
  121                    boost::lexical_cast<std::string>(value_->doubleValue());
 
  122                if (repr.find_first_of(
'.') == std::string::npos) {
 
  130                      << name_ << 
"' parameter");
 
  133    } 
catch (
const boost::bad_lexical_cast& ex) {
 
  135                  "the parameter '" << name_ << 
"' to string");
 
  138    return (value_->stringValue());
 
 
  144    return (value_->intValue());
 
 
  150    return (value_->boolValue());
 
 
  156    return (value_->doubleValue());
 
 
  160StampedValue::validateConstruct()
 const {
 
  163                  << name_ << 
"' parameter is NULL");
 
  166    auto type = value_->getType();
 
  172        isc_throw(TypeError, 
"StampedValue: provided value of the '" 
  173                  << name_ << 
"' parameter has invalid type: " 
  178        size_t count = value_->mapValue().size();
 
  180            isc_throw(BadValue, 
"StampedValue: provided value of the '" 
  181                      << name_ << 
"' parameter has more than one element in the map");
 
  184            type = value_->mapValue().begin()->second->getType();
 
  189                isc_throw(BadValue, 
"StampedValue: provided value of the '" 
  190                          << name_ << 
"." << value_->mapValue().begin()->first
 
  191                          << 
"' parameter has invalid type: " 
  201        isc_throw(InvalidOperation, 
"StampedValue: attempt to get null value " 
  202                  "of the '" << name_ << 
"' parameter");
 
  206        isc_throw(TypeError, 
"StampedValue: attempt to access a '" 
  208                  << 
", but this parameter has " 
static std::string typeToName(Element::types type)
Returns the name of the given type as a string.
A generic exception that is thrown if a parameter given to a method is considered invalid in that con...
A generic exception that is thrown if a function is called in a prohibited way.
The Element class represents a piece of data, used by the command channel and configuration parts.
static ElementPtr create(const Position &pos=ZERO_POSITION())
static std::string typeToName(Element::types type)
Returns the name of the given type as a string.
types
The types that an Element can hold.
StampedElement()
Constructor.
double getDoubleValue() const
Returns value as a real number.
bool getBoolValue() const
Returns value as a boolean.
StampedValue(const std::string &name)
Constructor creating a null value.
std::string getValue() const
Returns value as string.
int getType() const
Returns a type of the value.
int64_t getIntegerValue() const
Returns value as signed integer.
static StampedValuePtr create(const std::string &name)
Factory function creating a null value.
A standard Data module exception that is thrown if a function is called for an Element that has a wro...
#define isc_throw(type, stream)
A shortcut macro to insert known values into exception arguments.
boost::shared_ptr< StampedValue > StampedValuePtr
Pointer to the stamped value.
boost::shared_ptr< Element > ElementPtr
Defines the logger used by the top-level component of kea-lfc.