Kea 2.7.5
|
Class to store configured global parameters. More...
#include <cfg_globals.h>
Public Member Functions | |
CfgGlobals () | |
Instance members. | |
void | clear () |
Clear configured parameter values. | |
isc::data::ConstElementPtr | get (const std::string &name) const |
Get a configured parameter value by name. | |
isc::data::ConstElementPtr | get (int index) const |
Get a configured parameter value by index. | |
void | set (const std::string &name, isc::data::ConstElementPtr value) |
Set a configured parameter value by name. | |
void | set (int index, isc::data::ConstElementPtr value) |
Set a configured parameter value by index. | |
isc::data::ElementPtr | toElement () const |
Unparse configured global parameters. | |
const MapType | valuesMap () const |
Returns configured parameters as a map. | |
Public Member Functions inherited from isc::data::CfgToElement | |
virtual | ~CfgToElement () |
Destructor. | |
Static Public Attributes | |
static const std::map< std::string, int > | nameToIndex |
Name to index map. | |
Protected Attributes | |
std::vector< isc::data::ConstElementPtr > | values_ |
Vectors of values. | |
Class to store configured global parameters.
This class provides a direct access to a global parameter value using a vector as soon as the parameter name is known at compile time so in constant time vs in logarithm time using a map.
Definition at line 25 of file cfg_globals.h.
typedef std::map<std::string, isc::data::ConstElementPtr> isc::dhcp::CfgGlobals::MapType |
Type of name and value map.
Definition at line 148 of file cfg_globals.h.
enum isc::dhcp::CfgGlobals::Index : int |
Class members.
Enumeration of global parameters.
The C++ compiler is required to start with 0 and to increment by 1 so gives an index.
Names taken from SimpleParser4::GLOBAL4_PARAMETERS
and SimpleParser6::GLOBAL6_PARAMETERS
, first part with common parameters followed by DHCPv4 and DHCPv6 specific parameters. Keep the order, enum element names is uppercase with - replaced by _.
Definition at line 39 of file cfg_globals.h.
isc::dhcp::CfgGlobals::CfgGlobals | ( | ) |
Instance members.
Constructor.
Create a vector of null values.
Definition at line 119 of file cfg_globals.cc.
void isc::dhcp::CfgGlobals::clear | ( | ) |
Clear configured parameter values.
Definition at line 158 of file cfg_globals.cc.
ConstElementPtr isc::dhcp::CfgGlobals::get | ( | const std::string & | name | ) | const |
Get a configured parameter value by name.
name | Name of the global parameter. |
NotFound | if no global parameter has the given name. |
Definition at line 123 of file cfg_globals.cc.
References get(), isc_throw, and nameToIndex.
Referenced by get().
ConstElementPtr isc::dhcp::CfgGlobals::get | ( | int | index | ) | const |
Get a configured parameter value by index.
index | Index of the global parameter. |
OutOfRange | if the index is out of bounds. |
Definition at line 132 of file cfg_globals.cc.
void isc::dhcp::CfgGlobals::set | ( | const std::string & | name, |
isc::data::ConstElementPtr | value ) |
Set a configured parameter value by name.
name | Name of the global parameter. |
value | Value of the configured parameter to set. |
NotFound | if no global parameter has the given name. |
Definition at line 140 of file cfg_globals.cc.
References isc_throw, nameToIndex, and set().
Referenced by set().
void isc::dhcp::CfgGlobals::set | ( | int | index, |
isc::data::ConstElementPtr | value ) |
Set a configured parameter value by index.
index | Index of the global parameter. |
value | Value of the configured parameter to set. |
OutOfRange | if the index is out of bounds. |
Definition at line 150 of file cfg_globals.cc.
|
virtual |
Unparse configured global parameters.
Implements isc::data::CfgToElement.
Definition at line 180 of file cfg_globals.cc.
References isc::data::Element::createMap(), nameToIndex, and values_.
const CfgGlobals::MapType isc::dhcp::CfgGlobals::valuesMap | ( | ) | const |
Returns configured parameters as a map.
Definition at line 167 of file cfg_globals.cc.
References nameToIndex, and values_.
|
static |
Name to index map.
Definition at line 107 of file cfg_globals.h.
Referenced by get(), set(), toElement(), and valuesMap().
|
protected |
Vectors of values.
Definition at line 163 of file cfg_globals.h.
Referenced by clear(), get(), set(), toElement(), and valuesMap().