Kea  1.9.9-git
isc::util::State Class Reference

Defines a State within the State Model. More...

#include <state_model.h>

+ Inheritance diagram for isc::util::State:

Public Member Functions

 State (const int value, const std::string &label, StateHandler handler, const StatePausing &state_pausing=STATE_PAUSE_NEVER)
 Constructor. More...
virtual ~State ()
 Destructor. More...
void run ()
 Invokes the State's handler. More...
bool shouldPause ()
 Indicates if the state model should pause upon entering this state. More...
- Public Member Functions inherited from isc::util::LabeledValue
 LabeledValue (const int value, const std::string &label)
 Constructor. More...
virtual ~LabeledValue ()
 Destructor. More...
std::string getLabel () const
 Gets the text label of this instance. More...
int getValue () const
 Gets the integer value of this instance. More...
bool operator!= (const LabeledValue &other) const
 Inequality operator. More...
bool operator< (const LabeledValue &other) const
 Less-than operator. More...
bool operator== (const LabeledValue &other) const
 Equality operator. More...

Detailed Description

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.

Constructor & Destructor Documentation

isc::util::State::State ( const int  value,
const std::string &  label,
StateHandler  handler,
const StatePausing state_pausing = STATE_PAUSE_NEVER 


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 action.
state_pausingpausing mode selected for the given state. The default value is STATE_PAUSE_NEVER.

A typical invocation might look this:

std::bind(&StateModelDerivation::someHandler, this));
StateModelErrorif label is null or blank.

Definition at line 16 of file

isc::util::State::~State ( )


Definition at line 22 of file

Member Function Documentation

void isc::util::State::run ( )

Invokes the State's handler.

Definition at line 26 of file

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

References isc::util::STATE_PAUSE_ALWAYS, and isc::util::STATE_PAUSE_ONCE.

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