Events
Events provide asynchronous communication between reactive objects or tasks. Events can trigger transitions in statecharts.
In Rhapsody® Developer for C, events are implemented as objects (structures). The abstract data type and event structure are defined in the package specification file as follows:
typedef struct evStart evStart;
struct evStart {
RiCEvent ric_event;
};
An instance of an RiCEvent
object
is embedded in the structure of the event as a data member.
RiCEvent
is a predefined event type provided by the Rhapsody Developer for C
framework.Although events are implemented as objects, they are modeled as operations. Therefore, an event does not have attributes and only has initialization and cleanup operations.
Each event is assigned a dynamic ID by default:
/*## package Default */
#define evStart_Default_id 1
The event ID can change if the same
event is reused
in multiple components, for example, if the same event is used in
client and server components. To avoid this situation, which can cause
problems in distributed systems, you can assign a permanent ID to
an event by setting the CG::Event::Id
property.