13#include <boost/pointer_cast.hpp>
27 "argument is not a list Element");
29 for (
size_t i = 0; i < list->size(); ++i) {
33 "null pointer from the list at " << i);
37 "not a map from the list at " << i);
39 if (item->size() != 2) {
41 "bad map size from the list at " << i);
46 "no id from a map at " << i);
50 "not integer id from a map at " <<i);
56 "no reservations for subnet ID " << subnet_id);
58 map_.insert(std::make_pair(subnet_id,
59 boost::const_pointer_cast<Element>(resvs)));
65 for (
auto const& item : map_) {
68 pair->set(
"reservations", item.second);
75 CfgHostsMap::iterator item = map_.find(
id);
76 if (item != map_.end()) {
77 item->second->add(resv);
81 map_.insert(std::make_pair(
id, resvs));
86 CfgHostsMap::const_iterator item = map_.find(
id);
87 if (item != map_.end()) {
88 return (item->second);
A generic exception that is thrown if a parameter given to a method is considered invalid in that con...
static ElementPtr create(const Position &pos=ZERO_POSITION())
static ElementPtr createMap(const Position &pos=ZERO_POSITION())
Creates an empty MapElement type ElementPtr.
static ElementPtr createList(const Position &pos=ZERO_POSITION())
Creates an empty ListElement type ElementPtr.
isc::data::ConstElementPtr get(SubnetID id) const
Return the host reservations for a subnet ID.
void internalize(isc::data::ConstElementPtr list)
Internalize a list Element.
void add(SubnetID id, isc::data::ElementPtr resv)
Add a host reservation to the map.
isc::data::ElementPtr externalize() const
Externalize the map to a list Element.
#define isc_throw(type, stream)
A shortcut macro to insert known values into exception arguments.
boost::shared_ptr< const Element > ConstElementPtr
boost::shared_ptr< Element > ElementPtr
uint32_t SubnetID
Defines unique IPv4 or IPv6 subnet identifier.
Defines the logger used by the top-level component of kea-lfc.