Kea  2.3.3-git
data.h File Reference
#include <iostream>
#include <map>
#include <stdexcept>
#include <string>
#include <vector>
#include <boost/shared_ptr.hpp>
#include <stdint.h>
#include <exceptions/exceptions.h>
+ Include dependency graph for data.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

class  isc::data::BoolElement
 
class  isc::data::DoubleElement
 
class  isc::data::Element
 The Element class represents a piece of data, used by the command channel and configuration parts. More...
 
struct  isc::data::HierarchyTraversalTest
 Structure holding the test functions used to traverse the element hierarchy. More...
 
class  isc::data::IntElement
 Notes: IntElement type is changed to int64_t. More...
 
class  isc::data::JSONError
 A standard Data module exception that is thrown if a parse error is encountered when constructing an Element from a string. More...
 
class  isc::data::ListElement
 
class  isc::data::MapElement
 
class  isc::data::NullElement
 
struct  isc::data::Element::Position
 Represents the position of the data element within a configuration string. More...
 
class  isc::data::StringElement
 
class  isc::data::TypeError
 A standard Data module exception that is thrown if a function is called for an Element that has a wrong type (e.g. More...
 

Namespaces

 isc
 Defines the logger used by the top-level component of kea-lfc.
 
 isc::data
 

Macros

#define throwTypeError(error)
 Add the position to a TypeError message should be used in place of isc_throw(TypeError, error) More...
 

Typedefs

typedef boost::shared_ptr< const Element > isc::data::ConstElementPtr
 
typedef boost::shared_ptr< Element > isc::data::ElementPtr
 
typedef std::map< std::string, HierarchyTraversalTest > isc::data::FunctionMap
 Mapping between a container name and functions used to match elements inside the container. More...
 
typedef std::vector< FunctionMap > isc::data::HierarchyDescriptor
 Hierarchy descriptor of the containers in a specific Element hierarchy tree. More...
 
typedef std::function< bool(const std::string &)> isc::data::IsKeyTestFunc
 Function used to check if the key is used for identification. More...
 
typedef std::function< bool(ElementPtr &, ElementPtr &)> isc::data::MatchTestFunc
 Function used to check if two MapElements refer to the same configuration data. More...
 
typedef std::function< bool(ElementPtr &)> isc::data::NoDataTestFunc
 Function used to check if the data provided for the element contains only information used for identification, or it contains extra useful data. More...
 

Functions

ElementPtr isc::data::copy (ConstElementPtr from, int level=100)
 Copy the data up to a nesting level. More...
 
void isc::data::extend (const std::string &container, const std::string &extension, ElementPtr &element, ElementPtr &other, HierarchyDescriptor &hierarchy, std::string key, size_t idx=0, bool alter=false)
 Extends data by adding the specified 'extension' elements from 'other' inside the 'container' element (recursively). More...
 
bool isc::data::isEquivalent (ConstElementPtr a, ConstElementPtr b)
 Compares the data with other using unordered lists. More...
 
bool isc::data::isNull (ConstElementPtr p)
 Checks whether the given ElementPtr is a NULL pointer. More...
 
void isc::data::merge (ElementPtr element, ConstElementPtr other)
 Merges the data from other into element. More...
 
void isc::data::mergeDiffAdd (ElementPtr &element, ElementPtr &other, HierarchyDescriptor &hierarchy, std::string key, size_t idx=0)
 Merges the diff data by adding the missing elements from 'other' to 'element' (recursively). More...
 
void isc::data::mergeDiffDel (ElementPtr &element, ElementPtr &other, HierarchyDescriptor &hierarchy, std::string key, size_t idx=0)
 Merges the diff data by removing the data present in 'other' from 'element' (recursively). More...
 
bool isc::data::operator!= (const Element &a, const Element &b)
 
bool isc::data::operator< (Element const &a, Element const &b)
 
std::ostream & isc::data::operator<< (std::ostream &out, const Element::Position &pos)
 Insert Element::Position as a string into stream. More...
 
std::ostream & isc::data::operator<< (std::ostream &out, const Element &e)
 Insert the Element as a string into stream. More...
 
bool isc::data::operator== (const Element &a, const Element &b)
 
void isc::data::prettyPrint (ConstElementPtr element, std::ostream &out, unsigned indent=0, unsigned step=2)
 Pretty prints the data into stream. More...
 
std::string isc::data::prettyPrint (ConstElementPtr element, unsigned indent=0, unsigned step=2)
 Pretty prints the data into string. More...
 
void isc::data::removeIdentical (ElementPtr a, ConstElementPtr b)
 Remove all values from the first ElementPtr that are equal in the second. More...
 
ConstElementPtr isc::data::removeIdentical (ConstElementPtr a, ConstElementPtr b)
 Create a new ElementPtr from the first ElementPtr, removing all values that are equal in the second. More...
 

Macro Definition Documentation

◆ throwTypeError

#define throwTypeError (   error)
Value:
{ \
std::string msg_ = error; \
if ((position_.file_ != "") || \
(position_.line_ != 0) || \
(position_.pos_ != 0)) { \
msg_ += " in (" + position_.str() + ")"; \
} \
isc_throw(TypeError, msg_); \
}

Add the position to a TypeError message should be used in place of isc_throw(TypeError, error)

Definition at line 187 of file data.h.

Referenced by isc::data::Element::add(), isc::data::Element::boolValue(), isc::data::Element::contains(), isc::data::Element::doubleValue(), isc::data::Element::empty(), isc::data::Element::find(), isc::data::Element::get(), isc::data::Element::getNonConst(), isc::data::Element::intValue(), isc::data::Element::listValue(), isc::data::Element::mapValue(), isc::data::Element::remove(), isc::data::Element::set(), isc::data::Element::size(), and isc::data::Element::stringValue().