Kea 2.7.5
isc::dhcp::OptionSpaceContainer< ContainerType, ItemType, Selector > Class Template Reference

Simple container for option spaces holding various items. More...

#include <option_space_container.h>

+ Inheritance diagram for isc::dhcp::OptionSpaceContainer< ContainerType, ItemType, Selector >:

Public Types

typedef boost::shared_ptr< ContainerType > ItemsContainerPtr
 Pointer to the container.
 

Public Member Functions

void addItem (const ItemType &item, const Selector &option_space)
 Adds a new item to the option_space.
 
void clearItems ()
 Remove all items from the container.
 
uint64_t deleteItems (const uint64_t id)
 Remove all options or option definitions with a given database identifier.
 
bool empty () const
 Indicates the container is empty.
 
bool equals (const OptionSpaceContainer &other) const
 Check if two containers are equal.
 
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.
 

Detailed Description

template<typename ContainerType, typename ItemType, typename Selector>
class isc::dhcp::OptionSpaceContainer< ContainerType, ItemType, Selector >

Simple container for option spaces holding various items.

This helper class is used to store items of various types that are grouped by option space names. Each option space is mapped to a container that holds items which specifically can be OptionDefinition objects or Subnet::OptionDescriptor structures.

Template Parameters
ContainerTypeof the container holding items within option space.
ItemTypetype of the item being held by the container.
Selectora string (for option spaces) or uint32_t (for vendor options)

Definition at line 32 of file option_space_container.h.

Member Typedef Documentation

◆ ItemsContainerPtr

template<typename ContainerType , typename ItemType , typename Selector >
typedef boost::shared_ptr<ContainerType> isc::dhcp::OptionSpaceContainer< ContainerType, ItemType, Selector >::ItemsContainerPtr

Pointer to the container.

Definition at line 36 of file option_space_container.h.

Member Function Documentation

◆ addItem()

template<typename ContainerType , typename ItemType , typename Selector >
void isc::dhcp::OptionSpaceContainer< ContainerType, ItemType, Selector >::addItem ( const ItemType & item,
const Selector & option_space )
inline

Adds a new item to the option_space.

Parameters
itemreference to the item being added.
option_spacename or vendor-id of the option space

Definition at line 49 of file option_space_container.h.

References isc::dhcp::OptionSpaceContainer< ContainerType, ItemType, Selector >::getItems().

Referenced by isc::dhcp::CfgOption::add(), and isc::dhcp::OptionDefSpaceContainer::addItem().

+ Here is the call graph for this function:

◆ clearItems()

template<typename ContainerType , typename ItemType , typename Selector >
void isc::dhcp::OptionSpaceContainer< ContainerType, ItemType, Selector >::clearItems ( )
inline

Remove all items from the container.

Definition at line 94 of file option_space_container.h.

◆ deleteItems()

template<typename ContainerType , typename ItemType , typename Selector >
uint64_t isc::dhcp::OptionSpaceContainer< ContainerType, ItemType, Selector >::deleteItems ( const uint64_t id)
inline

Remove all options or option definitions with a given database identifier.

Note that there are cases when there will be multiple options or option definitions having the same id (typically id of 0). When configuration backend is in use it sets the unique ids from the database. In cases when the configuration backend is not used, the ids default to 0. Passing the id of 0 would result in deleting all options or option definitions that were not added via the database.

Parameters
idIdentifier of the items to be deleted.
Returns
Number of deleted options or option definitions.

Definition at line 112 of file option_space_container.h.

Referenced by isc::dhcp::CfgOption::del(), and isc::dhcp::CfgOptionDef::del().

◆ empty()

template<typename ContainerType , typename ItemType , typename Selector >
bool isc::dhcp::OptionSpaceContainer< ContainerType, ItemType, Selector >::empty ( ) const
inline

Indicates the container is empty.

Returns
true when the container is empty

Definition at line 41 of file option_space_container.h.

Referenced by isc::dhcp::CfgOption::empty().

◆ equals()

template<typename ContainerType , typename ItemType , typename Selector >
bool isc::dhcp::OptionSpaceContainer< ContainerType, ItemType, Selector >::equals ( const OptionSpaceContainer< ContainerType, ItemType, Selector > & other) const
inline

Check if two containers are equal.

This method checks if option space container contains exactly the same selectors and that there are exactly the same items added for each selector. The order of items doesn't matter.

Parameters
otherOther container to compare to.
Returns
true if containers are equal, false otherwise.

Definition at line 132 of file option_space_container.h.

Referenced by isc::dhcp::CfgOption::equals().

◆ getItems()

template<typename ContainerType , typename ItemType , typename Selector >
ItemsContainerPtr isc::dhcp::OptionSpaceContainer< ContainerType, ItemType, Selector >::getItems ( const Selector & option_space) const
inline

Get all items for the particular option space.

Warning
when there are no items for the specified option space an empty container is created and returned. However this container is not added to the list of option spaces.
Parameters
option_spacename or vendor-id of the option space.
Returns
pointer to the container holding items.

Definition at line 67 of file option_space_container.h.

Referenced by isc::dhcp::OptionSpaceContainer< ContainerType, ItemType, Selector >::addItem(), isc::dhcp::CfgOption::getAll(), isc::dhcp::CfgOptionDef::getAll(), and isc::dhcp::CfgOption::getAll().

◆ getOptionSpaceNames()

template<typename ContainerType , typename ItemType , typename Selector >
std::list< Selector > isc::dhcp::OptionSpaceContainer< ContainerType, ItemType, Selector >::getOptionSpaceNames ( ) const
inline

Get a list of existing option spaces.

Returns
a list of option spaces.
Todo
This function is likely to be removed once we create a structure of OptionSpaces defined through the configuration manager.

Definition at line 83 of file option_space_container.h.

Referenced by isc::dhcp::CfgOptionDef::copyTo(), isc::dhcp::CfgOptionDef::equals(), isc::dhcp::CfgOption::getOptionSpaceNames(), isc::dhcp::CfgOption::getVendorIds(), isc::dhcp::CfgOptionDef::merge(), isc::dhcp::LibDHCP::setRuntimeOptionDefs(), isc::dhcp::CfgOptionDef::toElementWithMetadata(), and isc::dhcp::CfgOption::toElementWithMetadata().


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