Kea 2.7.6
|
This template specifies a parameter value. More...
#include <triplet.h>
Public Member Functions | |
Triplet () | |
Constructor without parameters. | |
Triplet (T min, T def, T max) | |
Sets the default value and thresholds. | |
Triplet (T value) | |
Sets a fixed value. | |
T | get (T hint) const |
Returns value with a hint. | |
T | getMax () const |
Returns a maximum allowed value. | |
T | getMin () const |
Returns a minimum allowed value. | |
Triplet< T > & | operator= (T other) |
Base type to Triplet conversion. | |
Public Member Functions inherited from isc::util::Optional< T > | |
Optional () | |
Default constructor. | |
Optional () | |
Specialization of the default Optional constructor for strings. | |
template<typename A > | |
Optional (A value, const bool unspecified=false) | |
Constructor. | |
bool | empty () const |
Checks if the encapsulated value is empty. | |
bool | empty () const |
Specialization of the Optional::empty method for strings. | |
T | get () const |
Retrieves the encapsulated value. | |
operator T () const | |
Type cast operator. | |
bool | operator!= (const T &other) const |
Inequality operator. | |
template<typename A > | |
Optional< T > & | operator= (A other) |
Assigns a new value value and marks it "specified". | |
bool | operator== (const T &other) const |
Equality operator. | |
bool | unspecified () const |
Checks if the value has been specified or unspecified. | |
void | unspecified (bool unspecified) |
Modifies the flag that indicates whether the value is specified or unspecified. | |
T | valueOr (T const &or_value) const |
Retrieves the encapsulated value if specified, or the given value otherwise. | |
Additional Inherited Members | |
Public Types inherited from isc::util::Optional< T > | |
typedef T | ValueType |
Type of the encapsulated value. | |
Protected Attributes inherited from isc::util::Optional< T > | |
T | default_ |
Encapsulated value. | |
bool | unspecified_ |
Flag which indicates if the value is specified. | |
This template specifies a parameter value.
This template class is used to store configuration parameters, like lifetime or T1. It defines 3 parameters: min, default, and max value. If the particular configuration parameter is not mandatory, it is possible to mark the parameter described by a Triplet
"unspecified". For example, the T1 and T2 values in DHCPv4 server are optional and may be not specified in the configuration. The Triplets
describing these parameters will be marked "unspecified". If the server finds that the particular parameter is unspecified it will not include it (e.g. option 58 or 59) in the message to a client.
There are 3 constructors:
It will be used with integer types. It provides necessary operators, so it can be assigned to a plain integer or integer assigned to a Triplet. See TripletTest.operator test for details on an easy Triplet usage.
|
inline |
|
inline |
|
inline |
|
inline |
Returns value with a hint.
DHCP protocol treats any values sent by a client as hints. This is a method that implements that. We can assign any value from configured range that client asks.
hint | A value being returned when if it is within the range between min and max value of Triplet . If the hint value is lower than min value, the min value is returned. if the hint is greater than max value, the max value is returned. |
Definition at line 99 of file triplet.h.
Referenced by isc::db::PsqlBindArray::add(), isc::db::PsqlBindArray::addMax(), isc::db::PsqlBindArray::addMin(), isc::dhcp::AllocEngine::getLifetimes6(), isc::dhcp::AllocEngine::getValidLft(), isc::dhcp::ClientClassDef::toElement(), and isc::dhcp::Network::toElement().
|
inline |
Returns a maximum allowed value.
Definition at line 112 of file triplet.h.
Referenced by isc::db::PsqlBindArray::addMax(), isc::dhcp::ClientClassDef::toElement(), and isc::dhcp::Network::toElement().
|
inline |
Returns a minimum allowed value.
Definition at line 85 of file triplet.h.
Referenced by isc::db::PsqlBindArray::addMin(), isc::dhcp::ClientClassDef::toElement(), and isc::dhcp::Network::toElement().
|
inline |
Base type to Triplet conversion.
Typically: uint32_t to Triplet assignment. It is very convenient to be able to simply write Triplet<uint32_t> x = 7;
other | A number to be assigned as min, max and default value. |