Kea 2.6.0
isc::util::StateSet Class Reference

Implements a unique set or dictionary of states. More...

#include <state_model.h>

+ Inheritance diagram for isc::util::StateSet:

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.
 
- Public Member Functions inherited from isc::util::LabeledValueSet
 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 LabeledValuePtrget (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 Public Attributes inherited from isc::util::LabeledValueSet
static const char * UNDEFINED_LABEL = "UNDEFINED"
 Defines a text label returned by when value is not found.
 

Detailed Description

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.

Constructor & Destructor Documentation

◆ StateSet()

isc::util::StateSet::StateSet ( )

Constructor.

Definition at line 42 of file state_model.cc.

◆ ~StateSet()

isc::util::StateSet::~StateSet ( )
virtual

Destructor.

Definition at line 45 of file state_model.cc.

Member Function Documentation

◆ add()

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.

Parameters
valueis the numeric value of the state
labelis the text label to assign to the state
handleris the bound instance method which handles the state's
state_pausingstate pausing mode for the given state.
Exceptions
StateModelErrorif 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().

+ Here is the call graph for this function:

◆ getState()

const StatePtr isc::util::StateSet::getState ( int  value)

Fetches a state for the given value.

Parameters
valuethe numeric value of the state desired
Returns
A constant pointer the State found. Note, this relies on dynamic cast and cannot return a pointer reference.
Exceptions
StateModelErrorif 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().

+ Here is the call graph for this function:

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