| Kea 3.0.2-git

isc::data::DoubleElement Class Reference

`#include <data.h>`

Inheritance diagram for isc::data::DoubleElement:
[legend]

## Public Member Functions
| DoubleElement (double v, const Position &pos=ZERO_POSITION())
double | doubleValue () const
bool | equals (const Element &other) const
virtual bool | getValue (bool &t) const
bool | getValue (double &t) const
virtual bool | getValue (int64_t &t) const
virtual bool | getValue (std::map< std::string, ConstElementPtr > &t) const
virtual bool | getValue (std::string &t) const
virtual bool | getValue (std::vector< ElementPtr > &t) const
virtual bool | setValue (const bool t)
bool | setValue (const double v)
bool | setValue (const int i)
virtual bool | setValue (const isc::util::int128_t &v)
bool | setValue (const long int i)
virtual bool | setValue (const long long int v)
virtual bool | setValue (const std::map< std::string, ConstElementPtr > &v)
virtual bool | setValue (const std::string &v)
virtual bool | setValue (const std::vector< ElementPtr > &v)
void | toJSON (std::ostream &ss) const
| Converts the Element to JSON format and appends it to the given stringstream.
Public Member Functions inherited from isc::data::Element
virtual | ~Element ()
const Position & | getPosition () const
| Returns position where the data element's value starts in a configuration string.
types | getType () const
std::string | str () const
| Returns a string representing the Element and all its child elements; note that this is different from stringValue(), which only returns the single value of a StringElement.
std::string | toWire () const
| Returns the wireformat for the Element and all its child elements.
void | toWire (std::ostream &out) const
virtual int64_t | intValue () const
virtual isc::util::int128_t | bigIntValue () const
virtual bool | boolValue () const
virtual std::string | stringValue () const
virtual const std::vector< ElementPtr > & | listValue () const
virtual const std::map< std::string, ConstElementPtr > & | mapValue () const
bool | setValue (const long int i)
bool | setValue (const int i)
virtual ConstElementPtr | get (const int i) const
| Returns the ElementPtr at the given index.
virtual ElementPtr | getNonConst (const int i) const
| returns element as non-const pointer
virtual void | set (const size_t i, ElementPtr element)
| Sets the ElementPtr at the given index.
virtual void | add (ElementPtr element)
| Adds an ElementPtr to the list.
virtual void | remove (const int i)
| Removes the element at the given position.
virtual size_t | size () const
| Returns the number of elements in the list.
virtual bool | empty () const
| Return true if there are no elements in the list.
virtual ConstElementPtr | get (const std::string &name) const
| Returns the ElementPtr at the given key.
virtual void | set (const std::string &name, ConstElementPtr element)
| Sets the ElementPtr at the given key.
virtual void | remove (const std::string &name)
| Remove the ElementPtr at the given key.
virtual bool | contains (const std::string &name) const
| Checks if there is data at the given key.
virtual ConstElementPtr | find (const std::string &identifier) const
| Recursively finds any data at the given identifier.
virtual bool | find (const std::string &identifier, ConstElementPtr &t) const
| See `Element::find()`.
void | removeEmptyContainersRecursively ()
| Remove all empty maps and lists from this Element and its descendants.

## Additional Inherited Members
Public Types inherited from isc::data::Element
enum | types : int { integer = 0 , real = 1 , boolean = 2 , null = 3 , string = 4 , bigint = 5 , list = 6 , map = 7 , any = 8 }
| The types that an Element can hold. More...
Static Public Member Functions inherited from isc::data::Element
static const Position & | ZERO_POSITION ()
| Returns `Position` object with line_ and pos_ set to 0, and with an empty file name.
static ElementPtr | create (const Position &pos=ZERO_POSITION())
static ElementPtr | create (const long long int i, const Position &pos=ZERO_POSITION())
static ElementPtr | create (const isc::util::int128_t &i, const Position &pos=ZERO_POSITION())
static ElementPtr | create (const int i, const Position &pos=ZERO_POSITION())
static ElementPtr | create (const long int i, const Position &pos=ZERO_POSITION())
static ElementPtr | create (const uint32_t i, const Position &pos=ZERO_POSITION())
static ElementPtr | create (const double d, const Position &pos=ZERO_POSITION())
static ElementPtr | create (const bool b, const Position &pos=ZERO_POSITION())
static ElementPtr | create (const std::string &s, const Position &pos=ZERO_POSITION())
static ElementPtr | create (const char *s, const Position &pos=ZERO_POSITION())
static ElementPtr | createList (const Position &pos=ZERO_POSITION())
| Creates an empty ListElement type ElementPtr.
static ElementPtr | createMap (const Position &pos=ZERO_POSITION())
| Creates an empty MapElement type ElementPtr.
static ElementPtr | fromJSON (const std::string &in, bool preproc=false)
| These functions will parse the given string (JSON) representation of a compound element.
static ElementPtr | fromJSON (std::istream &in, bool preproc=false)
| Creates an Element from the given input stream containing JSON formatted data.
static ElementPtr | fromJSON (std::istream &in, const std::string &file_name, bool preproc=false)
| Creates an Element from the given input stream containing JSON formatted data.
static ElementPtr | fromJSON (std::istream &in, const std::string &file, int &line, int &pos)
| Creates an Element from the given input stream, where we keep track of the location in the stream for error reporting.
static ElementPtr | fromJSONFile (const std::string &file_name, bool preproc=false)
| Reads contents of specified file and interprets it as JSON.
static std::string | typeToName (Element::types type)
| Returns the name of the given type as a string.
static Element::types | nameToType (const std::string &type_name)
| Converts the string to the corresponding type Throws a TypeError if the name is unknown.
static void | preprocess (std::istream &in, std::stringstream &out)
| input text preprocessor
static ElementPtr | fromWire (std::stringstream &in, int length)
| These function pparse the wireformat at the given stringstream (of the given length).
static ElementPtr | fromWire (const std::string &s)
| Creates an Element from the wire format in the given string Since the wire format is JSON, this is the same as fromJSON, and could be removed.
Protected Member Functions inherited from isc::data::Element
| Element (types t, const Position &pos=ZERO_POSITION())
| Constructor.

## Detailed Description

Definition at line 671 of file data.h.

## Constructor & Destructor Documentation

## ◆ DoubleElement()

isc::data::DoubleElement::DoubleElement | ( | double | v,
|  | const Position & | pos = ZERO_POSITION() )
| inline

Definition at line 675 of file data.h.

References isc::data::Element::Element(), and isc::data::Element::real.

Here is the call graph for this function:

## Member Function Documentation

## ◆ doubleValue()

double isc::data::DoubleElement::doubleValue | ( |  | ) | const
| inline virtual

Reimplemented from isc::data::Element.

Definition at line 677 of file data.h.

## ◆ equals()

bool isc::data::DoubleElement::equals | ( | const Element & | other | ) | const
| virtual

Returns
  true if the other ElementPtr has the same value and the same type (or a different and compatible type), false otherwise.

Implements isc::data::Element.

Definition at line 1049 of file data.cc.

References isc::data::Element::Element(), isc::data::Element::doubleValue(), isc::data::Element::getType(), and isc::data::Element::real.

Here is the call graph for this function:

## ◆ getValue() [1/6]

bool isc::data::Element::getValue | ( | bool & | t | ) | const
| virtual

Reimplemented from isc::data::Element.

Definition at line 266 of file data.cc.

## ◆ getValue() [2/6]

bool isc::data::DoubleElement::getValue | ( | double & | t | ) | const
| inline virtual

Reimplemented from isc::data::Element.

Definition at line 679 of file data.h.

## ◆ getValue() [3/6]

bool isc::data::Element::getValue | ( | int64_t & | t | ) | const
| virtual

Reimplemented from isc::data::Element.

Definition at line 264 of file data.cc.

## ◆ getValue() [4/6]

bool isc::data::Element::getValue | ( | std::map< std::string, ConstElementPtr > & | t | ) | const
| virtual

Reimplemented from isc::data::Element.

Definition at line 269 of file data.cc.

## ◆ getValue() [5/6]

bool isc::data::Element::getValue | ( | std::string & | t | ) | const
| virtual

Reimplemented from isc::data::Element.

Definition at line 267 of file data.cc.

## ◆ getValue() [6/6]

bool isc::data::Element::getValue | ( | std::vector< ElementPtr > & | t | ) | const
| virtual

Reimplemented from isc::data::Element.

Definition at line 268 of file data.cc.

## ◆ setValue() [1/9]

bool isc::data::Element::setValue | ( | const bool | t | ) |
| virtual

Reimplemented from isc::data::Element.

Definition at line 287 of file data.cc.

## ◆ setValue() [2/9]

bool isc::data::DoubleElement::setValue | ( | const double | v | ) |
| inline virtual

Reimplemented from isc::data::Element.

Definition at line 681 of file data.h.

## ◆ setValue() [3/9]

bool isc::data::Element::setValue | ( | const int | i | ) |
| inline

Definition at line 285 of file data.h.

## ◆ setValue() [4/9]

bool isc::data::Element::setValue | ( | const isc::util::int128_t & | v | ) |
| virtual

Reimplemented from isc::data::Element.

Definition at line 283 of file data.cc.

## ◆ setValue() [5/9]

bool isc::data::Element::setValue | ( | const long int | i | ) |
| inline

Definition at line 284 of file data.h.

## ◆ setValue() [6/9]

bool isc::data::Element::setValue | ( | const long long int | v | ) |
| virtual

Reimplemented from isc::data::Element.

Definition at line 282 of file data.cc.

## ◆ setValue() [7/9]

bool isc::data::Element::setValue | ( | const std::map< std::string, ConstElementPtr > & | v | ) |
| virtual

Reimplemented from isc::data::Element.

Definition at line 290 of file data.cc.

## ◆ setValue() [8/9]

bool isc::data::Element::setValue | ( | const std::string & | v | ) |
| virtual

Reimplemented from isc::data::Element.

Definition at line 288 of file data.cc.

## ◆ setValue() [9/9]

bool isc::data::Element::setValue | ( | const std::vector< ElementPtr > & | v | ) |
| virtual

Reimplemented from isc::data::Element.

Definition at line 289 of file data.cc.

## ◆ toJSON()

void isc::data::DoubleElement::toJSON | ( | std::ostream & | ss | ) | const
| virtual

Converts the Element to JSON format and appends it to the given stringstream.

Implements isc::data::Element.

Definition at line 844 of file data.cc.

References isc::data::Element::doubleValue().

Here is the call graph for this function:

The documentation for this class was generated from the following files:

- data.h
- data.cc