![]() |
Kea 2.7.3
|
Implements a unique set or dictionary of states. More...
#include <state_model.h>
Public Member Functions | |
StateSet () | |
Constructor. | |
virtual | ~StateSet () |
Destructor. | |
void | add (const int value, const std::string &label, StateHandler handler, const StatePausing &state_pausing) |
Adds a state definition to the set of states. | |
const StatePtr | getState (int value) |
Fetches a state for the given value. | |
![]() | |
LabeledValueSet () | |
Constructor. | |
virtual | ~LabeledValueSet () |
Destructor. | |
void | add (const int value, const std::string &label) |
Adds an entry to the set for the given value and label. | |
void | add (LabeledValuePtr entry) |
Adds the given entry to the set. | |
const LabeledValuePtr & | get (int value) |
Fetches a pointer to the entry associated with value. | |
std::string | getLabel (const int value) const |
Fetches the label for the given value. | |
bool | isDefined (const int value) const |
Tests if the set contains an entry for the given value. | |
Additional Inherited Members | |
![]() | |
static const char * | UNDEFINED_LABEL = "UNDEFINED" |
Defines a text label returned by when value is not found. | |
Implements a unique set or dictionary of states.
This class provides the means to construct and access a unique set of states. This provide the ability to validate state values, look up their text labels, and their handlers.
Definition at line 118 of file state_model.h.
isc::util::StateSet::StateSet | ( | ) |
Constructor.
Definition at line 42 of file state_model.cc.
|
virtual |
Destructor.
Definition at line 45 of file state_model.cc.
void isc::util::StateSet::add | ( | const int | value, |
const std::string & | label, | ||
StateHandler | handler, | ||
const StatePausing & | state_pausing ) |
Adds a state definition to the set of states.
value | is the numeric value of the state |
label | is the text label to assign to the state |
handler | is the bound instance method which handles the state's |
state_pausing | state pausing mode for the given state. |
StateModelError | if the value is already defined in the set, or if the label is null or blank. |
Definition at line 49 of file state_model.cc.
References isc::util::LabeledValueSet::add(), isc_throw, and isc::Exception::what().
Referenced by isc::util::StateModel::defineState().
const StatePtr isc::util::StateSet::getState | ( | int | value | ) |
Fetches a state for the given value.
value | the numeric value of the state desired |
StateModelError | if the value is undefined. |
Definition at line 61 of file state_model.cc.
References isc::util::LabeledValueSet::get(), isc_throw, and isc::util::LabeledValueSet::isDefined().
Referenced by isc::util::StateModel::getStateInternal().