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

DC_FsmEvent Class Reference
[Finite State Machines]

#include <DC_FsmEvent.h>

Inheritance diagram for DC_FsmEvent:

PunctualAction CC_RootObject DC_FromFsmEvent List of all members.

Detailed Description

Base class from which all FsmEvents are derived.

An FsmEvent is a punctual action that, when it is executed, causes an FSM to attempt a state transition. The FSM upon which the FsmEvent acts is called the target FSM. The FSM state to which the transition is commanded is called the target state. Both the target FSM and target state are encapsulated in the FsmEvent object as configuration parameters. This class encapsulate the following FsmEvent execution logic: when the event is executed, a state transition request to the target state is made to the target FSM. Other FsmEvent execution logic would in principle be possible. For instance, the state transition request might be not just to a certain target state but from a given starting state to a given target state. Alternative execution logic can be implemented by subclassing this class and overriding its doAction method.

Author:
Alessandro Pasetti (P&P Software GmbH)
Version:
1.0

Definition at line 38 of file DC_FsmEvent.h.

Public Member Functions

 DC_FsmEvent (void)
 Instantiate an FsmEvent object.

void setTargetFsm (CC_FSM *pTargetFsm)
 Setter method for the target FSM.

void setTargetState (TD_FsmStateIndex targetState)
 Setter method for the target state.

CC_FSMgetTargetFsm (void) const
 Getter method for the target FSM.

TD_FsmStateIndex getTargetState (void) const
 Getter method for the target state.

virtual bool isObjectConfigured (void)
 Perform a class-specific configuration check on a FsmEvent object: verify that the target FSM has been loaded, that the target state has been loaded, and that the loaded target state has a legal value.


Protected Member Functions

virtual TD_ActionOutcome doAction (void)
 Execute the FsmEvent: lodge a request to the target FSM to perform a state transition to the target state.


Constructor & Destructor Documentation

DC_FsmEvent::DC_FsmEvent void   ) 
 

Instantiate an FsmEvent object.

Set the class identifier and initialize the target FSM and the target state. The target FSM and the target state are initialized to illegal values to signify that the FsmEvent is not yet configured.

Definition at line 18 of file DC_FsmEvent.cpp.


Member Function Documentation

TD_ActionOutcome DC_FsmEvent::doAction void   )  [protected, virtual]
 

Execute the FsmEvent: lodge a request to the target FSM to perform a state transition to the target state.

A pseudo-code implementation for this method is as follows:

   targetFsm.makeTransitionRequest(targetState);
   return ACTION_SUCCESS; 
The method assumes that the FsmEvent is correctly configured and that a target FSM and target state have been loaded. No check is made about the current state of the FSM. Applications that wish to implement a more complex execution logic should override this method. Only one return value can be returned by this implementation signifiying a successful outcome to execution of the puncutal action.

See also:
PunctualAction::execute
Returns:
the SUCCESS code for the FsmEvent punctual action

Implements PunctualAction.

Reimplemented in DC_FromFsmEvent.

Definition at line 49 of file DC_FsmEvent.cpp.

CC_FSM * DC_FsmEvent::getTargetFsm void   )  const
 

Getter method for the target FSM.

Returns:
the target FSM

Definition at line 34 of file DC_FsmEvent.cpp.

TD_FsmStateIndex DC_FsmEvent::getTargetState void   )  const
 

Getter method for the target state.

See also:
setTargetState
Returns:
the target state

Definition at line 39 of file DC_FsmEvent.cpp.

bool DC_FsmEvent::isObjectConfigured void   )  [virtual]
 

Perform a class-specific configuration check on a FsmEvent object: verify that the target FSM has been loaded, that the target state has been loaded, and that the loaded target state has a legal value.

The legality of the target state is checked by verifying that its value lies in the range [0,N-1] where N is the total number of states in the target FSM.

Reimplemented from CC_RootObject.

Reimplemented in DC_FromFsmEvent.

Definition at line 44 of file DC_FsmEvent.cpp.

void DC_FsmEvent::setTargetFsm CC_FSM pTargetFsm  ) 
 

Setter method for the target FSM.

This is an initialization method.

Parameters:
pTargetFsm the target FSM

Definition at line 24 of file DC_FsmEvent.cpp.

void DC_FsmEvent::setTargetState TD_FsmStateIndex  targetState  ) 
 

Setter method for the target state.

The target state is specified as an index that must lie in the range [0,N-1] where N is the total number of states in the target FSM.

This is an initialization method.

See also:
isObjectConfigured
Parameters:
targetState the target state

Definition at line 29 of file DC_FsmEvent.cpp.


The documentation for this class was generated from the following files:
Copyright 2003 P&P Software GmbH - All Rights Reserved