17 : value_(value), label_(label) {
19 isc_throw(LabeledValueError,
"labels cannot be empty");
38 return (this->value_ == other.value_);
43 return (this->value_ != other.value_);
48 return (this->value_ < other.value_);
72 const int value = entry->getValue();
75 "value: " << value <<
" is already defined as: "
90 LabeledValueMap::iterator it = map_.find(value);
91 if (it != map_.end()) {
92 return ((*it).second);
101 LabeledValueMap::const_iterator it = map_.find(value);
102 return (it != map_.end());
107 LabeledValueMap::const_iterator it = map_.find(value);
108 if (it != map_.end()) {
110 return (ptr->getLabel());
Thrown if an error is encountered handling a LabeledValue.
static const char * UNDEFINED_LABEL
Defines a text label returned by when value is not found.
bool isDefined(const int value) const
Tests if the set contains an entry for the given value.
const LabeledValuePtr & get(int value)
Fetches a pointer to the entry associated with value.
virtual ~LabeledValueSet()
Destructor.
std::string getLabel(const int value) const
Fetches the label for the given value.
void add(LabeledValuePtr entry)
Adds the given entry to the set.
LabeledValueSet()
Constructor.
Implements the concept of a constant value with a text label.
int getValue() const
Gets the integer value of this instance.
bool operator!=(const LabeledValue &other) const
Inequality operator.
LabeledValue(const int value, const std::string &label)
Constructor.
bool operator==(const LabeledValue &other) const
Equality operator.
bool operator<(const LabeledValue &other) const
Less-than operator.
std::string getLabel() const
Gets the text label of this instance.
virtual ~LabeledValue()
Destructor.
#define isc_throw(type, stream)
A shortcut macro to insert known values into exception arguments.
This file defines classes: LabeledValue and LabeledValueSet.
std::ostream & operator<<(std::ostream &os, const CSVRow &row)
Overrides standard output stream operator for CSVRow object.
boost::shared_ptr< LabeledValue > LabeledValuePtr
Defines a shared pointer to a LabeledValue instance.
Defines the logger used by the top-level component of kea-lfc.