Component interaction is performed via so-called events through instances of interfaces (that are called ports).

In each interface therefore the events that can be received (in events) and sent (out events) are specified.


An event is declared by its direction (in or out), type and name.

The direction indicates if the event is received by (in) or sent (out) from a component that will be implementing the interface.

Note that from the perspective of the component that is using (requires) the interface, the direction (in and out) is reversed. Looking at hierarchies of components this means that in-events travel top-down through the hierarchy and out-events travel bottom-up.

Out events are only allowed to have void type.

in return-type event-name();     // an in event declaration
out void event-name();           // an out event declaration

Events can also have a parameter list to pass data variables, see Using data variables and parameters.

[in/out] return-type event-name(parameter-list)

The parameter list is a set of the following: [in/out/inout] indicating whether the datatype is input for or output from the event, the parameter type and parameter name. see also Using data variables and parameters.


An interface with three void events (and a simple behaviour)

The following interface has three events defined: two in events and one out event.

The direction is as seen from the component implementing this interface.

interface IMotion
  in void start();
  in void stop();
  out void ready();

    on start, stop: {}

An interface with enum type event(s)

This interface has two incoming events. Both events are of an enum type. The type is defined in the first line of the interface declaration.

interface iSimpleProtocol
  enum Result {Ok, Failed, Error};

  in Result connect();
  in Result disconnect();

    on connect: reply(Result.Ok);    // Action = set return value to 'Result.Ok'
    on disconnect: reply(Result.Ok); // Action = set return value to 'Result.Ok'

On the receiving end the return value of an event must be captured in a local variable before it can be used in an if-statement.

See also: