Sending events

Events are generated through the RiCGEN() or CGEN() macro.

About this task

For example, the following statement sends a stopHeat() event to the Furnace:

RiCGEN(me->itsFurnace,stopHeat());

The RiC or C prefix on the CGEN() macro distinguishes this service from a similar event generation service provided by the IBM® Rational® Rhapsody® framework for other languages. RiCGEN(), CGEN(), and GEN() are all convenience macros that hide the details of event generation.

The first argument of the RiCGEN() statement is the target, or the object that is to receive the event. The target can be:

The second argument of the RiCGEN() statement is the event being sent, including event arguments (if it has any). The arguments must agree with the event parameters. For example, the following statement generates an updateDtemp event and sends it to the Room, passing the wanted temperature as an event parameter:

RiCGEN(me->itsRoom, updateDtemp(val));

Feedback