Next: Component if, Up: Component Imperative Statements   [Contents][Index]
actionWhen handling the response of a trigger, a component can send one
or more events over its ports.  The sending of a
provides-out-event or a requires-in event is referred to
as an action.
action        ::= port-name "." event-name argument-list
argument-list ::= "(" ")" | "(" expression ("," expression)* ")"
where port-name is the name of a port defined in the component,
and event-name is the name of an event defined in the interface
associated with the port.
Note that the event in an action statement must be of type
void.  For a typed action the reply value may not
be ignored.  A variable definition or an assign are the
appropriate ways to handle a reply value:
bool b = r.bool_event (); b = r.bool_event2 ();
or it can be used directly in a simple expression, optionally in combination with ==, !=, !, &&, or || (since 2.14.0)
if (r.bool_event ()) …; if (!r.bool_event ()) …; if (!r.bool_event () && b) …; if (r.enum_event () == result.FALSE) …; if (r.enum_event () != result.TRUE || b) …; reply (r.enum_event ()); reply (r.enum_event () != result.ERROR);
or in any expression (since 2.16.0).
Note: The restriction of using only one
actionorcallin an expression has been lifted (since 2.16.0).