Initialize and start statecharts
IBM® Engineering Systems Design Rhapsody® generates two operations to initialize statecharts and start reactive behavior:
initStatechart()
startBehavior()
Initializing statecharts
The
initStatechart()
operation initializes the statechart for a reactive object.
For example, the following initStatechart()
operation, generated in the
implementation file for HomeHeatingSystem
, initializes the statechart for
HomeHeatingSystem
:static void initStatechart(HomeHeatingSystem* const me) {
me->rootState_subState = HomeHeatingSystem_RiCNonState;
me->rootState_active = HomeHeatingSystem_RiCNonState;
}
This routine initializes the rootState_subState
and
rootState_active
pointers for the HomeHeatingSystem
object to
<object>_RiCNonState
(the default state is 0) when the
object is created.Starting reactive behavior
The startBehavior()
operation starts the behavior of reactive
objects:
- The
<package>_startBehavior()
operation starts the behavior of the reactive objects in a package. - The
<object>_startBehavior()
operation starts the behavior of an individual object.
Note that startBehavior()
is not to be called from within the
constructor.