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

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

#include <option_space_container.h>

Public Types

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

Public Member Functions

void addItem (const ItemType &item, const Selector &option_space)
 Adds a new item to the option_space. More...
 
void clearItems ()
 Remove all items from the container. More...
 
bool empty () const
 Indicates the container is empty. More...
 
bool equals (const OptionSpaceContainer &other) const
 Check if two containers are equal. More...
 
ItemsContainerPtr getItems (const Selector &option_space) const
 Get all items for the particular option space. More...
 
std::list< Selector > getOptionSpaceNames () const
 Get a list of existing option spaces. More...
 

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 28 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 32 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 45 of file option_space_container.h.

Referenced by isc::dhcp::bench::GenericHostDataSourceBenchmark::addTestOptions(), and isc::dhcp::LibDHCP::setRuntimeOptionDefs().

◆ 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 87 of file option_space_container.h.

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

◆ 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 37 of file option_space_container.h.

◆ 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 100 of file option_space_container.h.

◆ 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 60 of file option_space_container.h.

Referenced by isc::dhcp::OptionSpaceContainer< OptionContainer, OptionDescriptor, std::string >::addItem(), and isc::dhcp::LibDHCP::setRuntimeOptionDefs().

◆ 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 76 of file option_space_container.h.

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


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