Kea 2.7.4
isc::util::LabeledValue Class Reference

Implements the concept of a constant value with a text label. More...

#include <labeled_value.h>

+ Inheritance diagram for isc::util::LabeledValue:

Public Member Functions

 LabeledValue (const int value, const std::string &label)
 Constructor.
 
virtual ~LabeledValue ()
 Destructor.
 
std::string getLabel () const
 Gets the text label of this instance.
 
int getValue () const
 Gets the integer value of this instance.
 
bool operator!= (const LabeledValue &other) const
 Inequality operator.
 
bool operator< (const LabeledValue &other) const
 Less-than operator.
 
bool operator== (const LabeledValue &other) const
 Equality operator.
 

Detailed Description

Implements the concept of a constant value with a text label.

This class implements an association between a constant integer value and a text label. It provides a single constructor, accessors for both the value and label, and boolean operators which treat the value as the "key" for comparisons. This allows them to be assembled into dictionaries of unique values. Note, that the labels are not required to be unique but in practice it makes little sense to for them to be otherwise.

Definition at line 39 of file labeled_value.h.

Constructor & Destructor Documentation

◆ LabeledValue()

isc::util::LabeledValue::LabeledValue ( const int value,
const std::string & label )

Constructor.

Parameters
valuethe numeric constant value to be labeled.
labelthe text label to associate to this value.
Exceptions
LabeledValueErrorif label is empty.

Definition at line 16 of file labeled_value.cc.

References isc_throw.

◆ ~LabeledValue()

isc::util::LabeledValue::~LabeledValue ( )
virtual

Destructor.

Destructor is virtual to permit derivations.

Definition at line 23 of file labeled_value.cc.

Member Function Documentation

◆ getLabel()

std::string isc::util::LabeledValue::getLabel ( ) const

Gets the text label of this instance.

Returns
The text label as string

Definition at line 32 of file labeled_value.cc.

◆ getValue()

int isc::util::LabeledValue::getValue ( ) const

Gets the integer value of this instance.

Returns
integer value of this instance.

Definition at line 27 of file labeled_value.cc.

◆ operator!=()

bool isc::util::LabeledValue::operator!= ( const LabeledValue & other) const

Inequality operator.

Returns
True if a.value_ is not equal to b.value_.

Definition at line 42 of file labeled_value.cc.

◆ operator<()

bool isc::util::LabeledValue::operator< ( const LabeledValue & other) const

Less-than operator.

Returns
True if a.value_ is less than b.value_.

Definition at line 46 of file labeled_value.cc.

◆ operator==()

bool isc::util::LabeledValue::operator== ( const LabeledValue & other) const

Equality operator.

Returns
True if a.value_ is equal to b.value_.

Definition at line 37 of file labeled_value.cc.


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