RKH
|
Prev: Declaring the basic states
Next: Defining the state machine's objects
The conditional, choice, shallow history, and deep history pseudostates are created using RKH_CREATE_COND_STATE(), RKH_CREATE_CHOICE_STATE(), RKH_CREATE_SHALLOW_HISTORY_STATE(), and RKH_CREATE_DEEP_HISTORY_STATE() macros respectively, which are defined in rkh.h file. Also, these macros are broadly explained in the Quick reference section.
The following figures, Figure 11, Figure 12, Figure 13, and Figure 14 highlights the pseudostates "C1", "C2", "CH", "H", and "DH" respectively. Also, shows its implementation using the RKH framework.
A condition connector has one incoming transition and can have several outgoing transition segments called branches. Branches are labeled with guards that determine which one is to be actually taken. Since the condition connector is an OR connector, only one of the branches can be taken. Each condition connector can have one special branch with a guard labeled rkh_sm_else, which is taken if all the guards on the other branches are false. Branches cannot contain triggers, but in addition to a guard they may contain actions. A branch can enter another condition connector, thus providing for the nesting of branches. In RKH branches are defined by the macro RKH_BRANCH(). The general syntax of an expression labelling a branch in a statechart is "[c]/a" where c is a condition that guards the transition from being taken unless it is true, and a is an action that is carried out if and when the transition is taken. All of these parts are optional. The following listing shows the C2's branch table:
Explanation
x1()
is the guard function, dummy_act()
is the action function to be taken, and "S3" is the target state.abort
function will be invoked, and "S2" will be the next state.As said above, the actions and guards in RKH framework are represented by functions.
Prev: Declaring the basic states
Next: Defining the state machine's objects