Previous: , Up: Specifying Events   [Contents][Index]


3.2.3.2 Event Examples

3.2.3.3 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();
  behaviour
  {
    on start, stop: {}
  }
}

3.2.3.4 An interface with an enum type event

This interface has three events defined: two incoming events and one outgoing event. One of the incoming events is of an enum type, that is defined in the first line of the interface declaration.

interface iSimpleProtocol
{
  enum Result {Ok, Failed, Error};
  in Result connect();
  in Result disconnect();
  behaviour
  {
    on connect: reply(Result.Ok);    // Action = set return value to 'Result.Ok'
    on disconnect: reply(Result.Ok); // Action = set return value to 'Result.Ok'
  }
}

See also: