Kea 2.7.4
|
Defines a State within the State Model. More...
#include <state_model.h>
Public Member Functions | |
State (const int value, const std::string &label, StateHandler handler, const StatePausing &state_pausing=STATE_PAUSE_NEVER) | |
Constructor. | |
virtual | ~State () |
Destructor. | |
void | run () |
Invokes the State's handler. | |
bool | shouldPause () |
Indicates if the state model should pause upon entering this state. | |
Public Member Functions inherited from isc::util::LabeledValue | |
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. | |
Defines a State within the State Model.
This class provides the means to define a state within a set or dictionary of states, and assign the state an handler method to execute the state's actions. It derives from LabeledValue which allows a set of states to be keyed by integer constants.
Because a state model can be paused in selected states, this class also provides the means for specifying a pausing mode and for checking whether the state model should be paused when entering this state.
Definition at line 61 of file state_model.h.
isc::util::State::State | ( | const int | value, |
const std::string & | label, | ||
StateHandler | handler, | ||
const StatePausing & | state_pausing = STATE_PAUSE_NEVER ) |
Constructor.
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 action. |
state_pausing | pausing mode selected for the given state. The default value is STATE_PAUSE_NEVER . |
A typical invocation might look this:
StateModelError | if label is null or blank. |
Definition at line 16 of file state_model.cc.
|
virtual |
Destructor.
Definition at line 22 of file state_model.cc.
void isc::util::State::run | ( | ) |
Invokes the State's handler.
Definition at line 26 of file state_model.cc.
bool isc::util::State::shouldPause | ( | ) |
Indicates if the state model should pause upon entering this state.
It modifies the was_paused_
flag if the state model should pause. That way, it keeps track of visits in this particular state, making it possible to pause only upon the first transition to the state when STATE_PAUSE_ONCE
mode is used.
Definition at line 31 of file state_model.cc.
References isc::util::STATE_PAUSE_ALWAYS, and isc::util::STATE_PAUSE_ONCE.