#include <StateMachine.hh>
This class provides a template for all state objects to be defined within state machine subclasses. Derived classes must provide implementations for the entry, during and exit methods to define the semantics of a state.
Public Member Functions | |
State (StateMachine *p, const char n[]=NULL) | |
bool | addArc (Arc *a) |
Arc * | getActiveArc (void) |
virtual void | entry (void)=0 |
virtual void | during (void)=0 |
virtual void | exit (void)=0 |
const char * | getName (void) |
Public Attributes | |
StateMachine * | owner |
|
This constructor creates a state object instance belonging to the state machine p, with an optional name for debugging purposes. |
|
This method defines an outgoing arc from this state, which will be peridically checked to detect events that trigger state transitions. The Arc class encapsulates a target state as well as an associated Event object. It is recommended to use the macro Transition to create arcs instead of direct calls to this method. |
|
This method is peridocially called when this object is the current state for the owner state machine. Derived implementations can define the semantics of this state through this method in conjunction with entry and exit methods. |
|
This method is called when the owner state machine enters this state. Derived implementations can define the semantics of this state through this method in conjunction with during and exit methods. |
|
This method is called when the owner state machine exits this state. Derived implementations can define the semantics of this state through this method in conjunction with during and entry methods. |
|
This method checks all the outgoing arcs from this method and returns the first one that is active (i.e. with the associated event fired). |
|
This method returns the name of a state, mainly used for debugging and display purposes. |
|
This member is an internal pointer to the owner state machine. State methods (entry, during and exit) can access state machine members and methods through this member. |