rootState_dispatchEvent

This method is responsible for consuming an event inside a real statechart. It is called by the processEvent method.

Visibility
Public
Signature
virtual int rootState_dispatchEvent (short id);
Parameters
id

Specifies the ID of the event being consumed

Returns

The method returns one of the following values:

Notes

OMReactive has an implementation for the rootState_dispatchEvent and undoBusy methods. For flat statechart implementation, every class that inherits from OMReactive overwrites these methods according to its specific statechart implementation. For reusable statechart implementation, these methods are used as-is.

The Rational® Rhapsody® framework "knows" nothing about the real statechart; it knows about the rootState_entDef and rootState_dispatchEvent methods only. Every concrete class knows how to react to every event because it has generated code for itself. Therefore, for flat statechart implementation, the concrete class overwrites these two virtual methods with its own customized implementation.

Flat statecharts are constructed using switch and if statements.They are more efficient in both time and space, and offer a customized implementation. Reusable statecharts are constructed using objects, and provide typical object-oriented features (for example, inheritance, encapsulation, and polymorphism). They offer a generic implementation. The Rational Rhapsody default is flat statecharts.

In a reusable statechart implementation, rootstate_dispatchEvent invokes the root state takeTrigger operation.


Feedback