Main Page | Modules | Class Hierarchy | Compound List | File List | Compound Members | File Members | Related Pages

State Class Reference
[State Machine Utilities]

#include <StateMachine.hh>

List of all members.


Detailed Description

Abstract base class for all state machine states.

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

StateMachineowner


Constructor & Destructor Documentation

State::State StateMachine p,
const char  n[] = NULL
[inline]
 

This constructor creates a state object instance belonging to the state machine p, with an optional name for debugging purposes.


Member Function Documentation

bool State::addArc Arc *  a  )  [inline]
 

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.

virtual void State::during void   )  [pure virtual]
 

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.

virtual void State::entry void   )  [pure virtual]
 

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.

virtual void State::exit void   )  [pure virtual]
 

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.

Arc* State::getActiveArc void   ) 
 

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).

const char* State::getName void   )  [inline]
 

This method returns the name of a state, mainly used for debugging and display purposes.


Member Data Documentation

StateMachine* State::owner
 

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.


RHexLib Reference Documentation