![]() |
Kea 2.2.0
|
Class to store configured global parameters. More...
#include <cfg_globals.h>
Inheritance diagram for isc::dhcp::CfgGlobals:Public Member Functions | |
| CfgGlobals () | |
| Instance members. More... | |
| void | clear () |
| Clear configured parameter values. More... | |
| isc::data::ConstElementPtr | get (const std::string &name) const |
| Get a configured parameter value by name. More... | |
| isc::data::ConstElementPtr | get (int index) const |
| Get a configured parameter value by index. More... | |
| void | set (const std::string &name, isc::data::ConstElementPtr value) |
| Set a configured parameter value by name. More... | |
| void | set (int index, isc::data::ConstElementPtr value) |
| Set a configured parameter value by index. More... | |
| isc::data::ElementPtr | toElement () const |
| Unparse configured global parameters. More... | |
| const MapType | valuesMap () const |
| Returns configured parameters as a map. More... | |
Public Member Functions inherited from isc::data::CfgToElement | |
| virtual | ~CfgToElement () |
| Destructor. More... | |
| virtual isc::data::ElementPtr | toElement () const =0 |
| Unparse a configuration object. More... | |
Static Public Attributes | |
| static const std::map< std::string, int > | nameToIndex |
| Name to index map. More... | |
Protected Attributes | |
| std::vector< isc::data::ConstElementPtr > | values_ |
| Vectors of values. More... | |
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 137 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 109 of file cfg_globals.cc.
| void isc::dhcp::CfgGlobals::clear | ( | ) |
Clear configured parameter values.
Definition at line 147 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 113 of file cfg_globals.cc.
References get(), isc_throw, and nameToIndex.
Referenced by get().
Here is the call graph for this function:| 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 122 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 130 of file cfg_globals.cc.
References isc_throw, nameToIndex, and set().
Referenced by set().
Here is the call graph for this function:| 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 139 of file cfg_globals.cc.
|
virtual |
Unparse configured global parameters.
Implements isc::data::CfgToElement.
Definition at line 169 of file cfg_globals.cc.
References isc::data::Element::createMap(), nameToIndex, and values_.
Here is the call graph for this function:| const CfgGlobals::MapType isc::dhcp::CfgGlobals::valuesMap | ( | ) | const |
Returns configured parameters as a map.
Definition at line 156 of file cfg_globals.cc.
References nameToIndex, and values_.
|
static |
Name to index map.
Definition at line 96 of file cfg_globals.h.
Referenced by get(), set(), toElement(), and valuesMap().
|
protected |
Vectors of values.
Definition at line 152 of file cfg_globals.h.
Referenced by clear(), get(), set(), toElement(), and valuesMap().