#include <FsmState.h>
Inheritance diagram for FsmState:
An FsmState class encapsulates a state of an finite state machine (FSM).
This is an abstract class that declares abstract methods to implement: the actions associated to the FsmState and the checks associated to the FsmState. Concrete methods are also defined to implement configuration operations.
An FsmState can execute three types of actions. An initialization action that is a punctual action performed immediately after the state is entered. A continuation action that is an action performed every time the state is activated. A termination action that is a punctual action that is performed immediately before the state is exited. This class provides default implementation for the initialization and termination actions that do not do anything.
An FsmState performs three types of checks. An initialization check that checks whether the state can be entered. A exit check that checks whether the state can be exited. A termination check that checks whether the state has terminated execution and is ready to perform an autonomous state transition. This class provides default implementations for the initialization and exit checks that always return true (check is passed).
An FsmState holds a reference to a next state. This represents the state to which the current state wants to perform an autonomous transition after it has performed all its actions. FsmStates however are "passive" objects and state transitions are under the control of the FSM. This class provides a default implementation that returns a null pointer for the next state signifying that there is no next state.
Definition at line 63 of file FsmState.h.
Public Member Functions | |
FsmState (void) | |
Instantiate an FsmState object. | |
virtual bool | canEnter (void) |
Perform the entry check and return false if a transition into this state would put the system in an inconsistent or otherwise undesirable condition. | |
virtual void | doInit (void) |
Perform the initialization action associated to the FsmState. | |
virtual bool | canExit (void) |
Perform the exit check and return false if performing a transition out of the this state would leave the system in an inconsistent or otherwise undesirable condition. | |
virtual void | doContinue (void)=0 |
Perform the continued action associated to this state. | |
virtual void | doExit (void) |
Perform the exit action associated to this state. | |
virtual bool | isFinished (void) |
Perform a termination check and return true if the continued action associated to this state has been completed and an autonomous transition to a next state should be performed. | |
void | setNextState (FsmState *pNextState) |
Set the next state associated to this state. | |
FsmState * | getNextState (void) const |
Return the next state associated to this state. |
|
Instantiate an FsmState object. The next state is initialized to pNULL. Definition at line 14 of file FsmState.cpp. |
|
Perform the entry check and return false if a transition into this state would put the system in an inconsistent or otherwise undesirable condition. Note that the ultimate decision as to whether the state is entered or not lies with the FSM that could decide to ignore the return value of canEnter(). This class provides a default implementation that returns true (state can be entered).
Reimplemented in DC_DummyConfigurableFsmState. Definition at line 18 of file FsmState.cpp. |
|
Perform the exit check and return false if performing a transition out of the this state would leave the system in an inconsistent or otherwise undesirable condition. Note that the ultimate decision as to whether the state is exited or not lies with the FSM that could decide to ignore the return value of canExit(). This class provides a default implementation that returns true (state can be exited).
Reimplemented in DC_DummyConfigurableFsmState, and DC_NestedFsmActivatorWithExitCheck. Definition at line 26 of file FsmState.cpp. |
|
Perform the continued action associated to this state. This method is intended to be called by the FSM every time it is activated when this state is the current state.
Implemented in DC_AfsFsmState, DC_DummyConfigurableFsmState, DC_DummyFsmState, DC_NestedFsmActivator, DC_OCM_FsmState, DC_SBY_PostSepFsmState, DC_SBY_PreSepFsmState, DC_SCM_FsmState, DC_SM_PreSepFsmState, and DC_UnstableFsmState. |
|
Perform the exit action associated to this state. This method is intended to be called by the FSM object just before it exits this state. This class provides a default implementation that returns without doing anything.
Reimplemented in DC_AfsFsmState, DC_DummyConfigurableFsmState, and DC_SBY_PostSepFsmState. Definition at line 30 of file FsmState.cpp. |
|
Perform the initialization action associated to the FsmState. This method is intended to be called by the FSM immediately after the state has been entered. This class provides a default implementation that returns without doing anything.
Reimplemented in DC_AfsFsmState, DC_DummyConfigurableFsmState, DC_NestedFsmActivator, DC_OCM_FsmState, DC_SBY_PostSepFsmState, DC_SBY_PreSepFsmState, DC_SCM_FsmState, and DC_SM_PreSepFsmState. Definition at line 22 of file FsmState.cpp. |
|
Return the next state associated to this state. If no next state is associated to this state, then the method return pNULL.
Definition at line 17 of file FsmState_inl.h. |
|
Perform a termination check and return true if the continued action associated to this state has been completed and an autonomous transition to a next state should be performed. This class provides a default implementation that always returns "not terminated".
Reimplemented in DC_DummyConfigurableFsmState, DC_NestedFsmActivatorWithEndState, DC_OCM_FsmState, DC_SBY_PostSepFsmState, DC_SBY_PreSepFsmState, DC_SCM_FsmState, DC_SM_PreSepFsmState, and DC_UnstableFsmState. Definition at line 34 of file FsmState.cpp. |
|
Set the next state associated to this state. This method would normally be called only once during the application initialization phase. However, it is not formally classified as an initialization method in order to leave the option open to FsmState objects to dynamically set their next state on the basis of their termination status.
Definition at line 13 of file FsmState_inl.h. |