Kea 2.7.6
isc::dhcp::ValueStorage< ValueType > Class Template Reference

A template class that stores named elements of a given data type. More...

#include <dhcp_parsers.h>

Public Member Functions

void clear ()
 Deletes all of the entries from the store.
 
void delParam (const std::string &name)
 Remove the parameter from the store.
 
ValueType getOptionalParam (const std::string &name, const ValueType &default_value) const
 Returns the data value for an optional parameter.
 
ValueType getParam (const std::string &name) const
 Returns the data value for the given parameter.
 
const data::Element::PositiongetPosition (const std::string &name, const data::ConstElementPtr parent=data::ConstElementPtr()) const
 Returns position of the data element in the configuration string.
 
void setParam (const std::string &name, const ValueType &value, const data::Element::Position &position)
 Stores the parameter, its value and the position in the store.
 

Detailed Description

template<typename ValueType>
class isc::dhcp::ValueStorage< ValueType >

A template class that stores named elements of a given data type.

This template class is provides data value storage for configuration parameters of a given data type. The values are stored by parameter name and as instances of type "ValueType". Each value held in the storage has a corresponding position within a configuration string (file) specified as a: file name, line number and position within the line. The position information is used for logging when the particular configuration value causes a configuration error.

Template Parameters
ValueTypeis the data type of the elements to store.

Definition at line 56 of file dhcp_parsers.h.

Member Function Documentation

◆ clear()

template<typename ValueType >
void isc::dhcp::ValueStorage< ValueType >::clear ( )
inline

Deletes all of the entries from the store.

Definition at line 156 of file dhcp_parsers.h.

◆ delParam()

template<typename ValueType >
void isc::dhcp::ValueStorage< ValueType >::delParam ( const std::string & name)
inline

Remove the parameter from the store.

Deletes the entry for the given parameter from the store if it exists.

Parameters
nameis the name of the parameter to delete.

Definition at line 149 of file dhcp_parsers.h.

◆ getOptionalParam()

template<typename ValueType >
ValueType isc::dhcp::ValueStorage< ValueType >::getOptionalParam ( const std::string & name,
const ValueType & default_value ) const
inline

Returns the data value for an optional parameter.

Finds and returns the data value for the given parameter or a supplied default value if it is not found.

Parameters
nameis the name of the parameter for which the data value is desired.
default_valuevalue to use the default
Returns
The parameter's data value of type ValueType.

Definition at line 131 of file dhcp_parsers.h.

◆ getParam()

template<typename ValueType >
ValueType isc::dhcp::ValueStorage< ValueType >::getParam ( const std::string & name) const
inline

Returns the data value for the given parameter.

Finds and returns the data value for the given parameter.

Parameters
nameis the name of the parameter for which the data value is desired.
Returns
The parameter's data value of type ValueType.
Exceptions
DhcpConfigErrorif the parameter is not found.

Definition at line 83 of file dhcp_parsers.h.

References isc_throw.

◆ getPosition()

template<typename ValueType >
const data::Element::Position & isc::dhcp::ValueStorage< ValueType >::getPosition ( const std::string & name,
const data::ConstElementPtr parent = data::ConstElementPtr() ) const
inline

Returns position of the data element in the configuration string.

The returned object comprises file name, line number and the position within the particular line of the configuration string where the data element holding a particular value is located.

Parameters
nameis the name of the parameter which position is desired.
parentPointer to a data element which position should be returned when position of the specified parameter is not found.
Returns
Position of the data element or the position holding empty file name and two zeros if the position hasn't been specified for the particular value.

Definition at line 109 of file dhcp_parsers.h.

References isc::data::Element::ZERO_POSITION().

+ Here is the call graph for this function:

◆ setParam()

template<typename ValueType >
void isc::dhcp::ValueStorage< ValueType >::setParam ( const std::string & name,
const ValueType & value,
const data::Element::Position & position )
inline

Stores the parameter, its value and the position in the store.

If the parameter does not exist in the store, then it will be added, otherwise its data value and the position will be updated with the given values.

Parameters
nameis the name of the parameter to store.
valueis the data value to store.
positionis the position of the data element within a configuration string (file).

Definition at line 69 of file dhcp_parsers.h.


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