States

Rational® Rhapsody® Developer for C supports only the Flat implementation of statecharts. In the Flat implementation, states are implemented as enumerated types. Every state that has a substate is represented as a struct member of the enum.

For example, the statechart of the HomeHeatingSystem has only one (apparent) state, the systemControl state. This state is implemented in the HomeHeatingSystem structure as follows:

struct HomeHeatingSystem {
    RiCReactive ric_reactive;
    /*states enumeration: */
    enum HomeHeatingSystem_Enum{
         HomeHeatingSystem_RiCNonState=0,
         HomeHeatingSystem_systemControl=1}
    rootState_subState,
    rootState_active;
};

Switch statements are used to select between the outward bound transitions from a state. The switch statements are found in the operations that implement the event processing of a statechart. These statements include, among others, the takeEvent(), dispatchEvent(), serializeStates(), and exit() operations generated for each state. See the following sections for more information:


Feedback