Syntax for interfaces and ports

The following syntax is used for C code generation support for interfaces and ports. In these examples, we have an interface x, an operation f, a port p, and a class A.

Calling an operation through a C interface


[Interface]_[Operation]([object realizing the interface]
[, argList])

Example: To call operation x_f (object realizing the interface, port number), where the port number is 5, do:


x_f(me->itsl, 5);

Sending an event through a C interface


RiCGEN_[Interface]([object realizing the interface], [event([argList])])

Example: To send event RiCGEN_l(object realizing the interface, port number), do:


RiCGEN_l(me->itsl, evt());

Calling an operation through a C port


[Interface]_[Operation](OUT_PORT([class], [port], [interface]) 
[, argList])

Example: To call operation x_f (object realizing the port, port number), where the port number is 5, do:


x_f(OUT_PORT(A, p, x), 5);
Note: In C code, the OUT_PORT macro cannot be used with triggered operations or with ports whose multiplicity is greater than 1.

Sending an event through a C rapid port


RiCGEN_PORT([pointer to port], [event])

Example: To send event RiCGEN_PORT(object realizing the port, event), do:


RiCGEN_PORT(me->p, evt());

Sending an event through a C rapid port using ISR


RiCGEN_PORT_ISR([pointer to port], [event])

Example: To send event RiCGEN_PORT_ISR, do:


RiCGEN_PORT_ISR(me->p, evt());

Querying the port through which the event was received


RiCIS_PORT([object], [pointer to port])

Example: To query port RiCIS, do:


RiCIS_PORT(me, me->p);

Sending an event through a C non-rapid port


RiCGEN_PORT_I([class], [port], [interface], [event([argList])])

Example: To send event RiCGEN_PORT_I(object realizing the port, event), do:


RiCGEN_PORT_I(A, p, x, evt());