7 #ifndef OPTION_SPACE_CONTAINER_H 8 #define OPTION_SPACE_CONTAINER_H 27 template<
typename ContainerType,
typename ItemType,
typename Selector>
38 return (option_space_map_.empty());
45 void addItem(
const ItemType& item,
const Selector& option_space) {
47 items->push_back(item);
48 option_space_map_[option_space] = items;
61 const typename OptionSpaceMap::const_iterator& items =
62 option_space_map_.find(option_space);
63 if (items == option_space_map_.end()) {
66 return (items->second);
77 std::list<Selector> names;
78 for (
typename OptionSpaceMap::const_iterator space =
79 option_space_map_.begin();
80 space != option_space_map_.end(); ++space) {
81 names.push_back(space->first);
88 option_space_map_.clear();
101 for (
typename OptionSpaceMap::const_iterator it =
102 option_space_map_.begin(); it != option_space_map_.end();
105 typename OptionSpaceMap::const_iterator other_it =
106 other.option_space_map_.find(it->first);
107 if (other_it == other.option_space_map_.end()) {
113 if (it->second->size() != other_it->second->size()) {
118 for (
typename ContainerType::const_iterator items_it =
120 items_it != it->second->end(); ++items_it) {
122 bool match_found =
false;
123 for (
typename ContainerType::const_iterator other_items_it =
124 other_it->second->begin();
125 other_items_it != other_it->second->end();
127 if (items_it->equals(*other_items_it)) {
144 typedef std::map<Selector, ItemsContainerPtr> OptionSpaceMap;
145 OptionSpaceMap option_space_map_;
152 #endif // OPTION_SPACE_CONTAINER_H Simple container for option spaces holding various items.
ItemsContainerPtr getItems(const Selector &option_space) const
Get all items for the particular option space.
std::list< Selector > getOptionSpaceNames() const
Get a list of existing option spaces.
boost::shared_ptr< ContainerType > ItemsContainerPtr
Pointer to the container.
bool equals(const OptionSpaceContainer &other) const
Check if two containers are equal.
void clearItems()
Remove all items from the container.
Defines the logger used by the top-level component of kea-dhcp-ddns.
void addItem(const ItemType &item, const Selector &option_space)
Adds a new item to the option_space.
bool empty() const
Indicates the container is empty.