QM  6.1.1
Model-Based Design Tool
Loading...
Searching...
No Matches
Generating Code for State Machines

$define1Generating Comments

As described in Section State Machines, QM™ provides extensive support for modern Hierarchical State Machines (HSMs) (UML Statecharts). From the code engineering point of view, state machines are the most "constructive" element of the UML and the support of state machine code generation is the most valuable aspect of QM. This section describes the state machine implementation strategies and coding aspects for hierarchical state machines in C and C++.

Class Calc with a hierarchical state machine used in the following examples of code generation

Implementation Strategies

As described in Section State Machine Base Classes, QM™ supports two state machine implementation strategies, depending on the selected base class for the application-level state machine:

State Machine Constructor

Apart from selecting the superclass (base class) in the Class Property Sheet, the constructor of the application-level state machine must call the appropriate base class constructor. For example, a state machine class derived from QHsm must call the QHsm constructor and class derived from QMActive must call QMActive constructor.

State Machine Constructor in C

The Section Class Constructors in C describes how to model class constructors in C. has been described in the B

State Machine Constructor in C++

Action Code

Action Code in C

Accessing Attributes

Accessing Event Parameters

Action Code in C++

Accessing Attributes

Accessing Event Parameters

$define1Generating Comments