Next: Component Models, Previous: Types and Expressions, Up: Dezyne Syntax [Contents][Index]
An interface has a name, can define some local types, defines a collection of events, and a behaviour describing the protocol on its events. A syntax example:
interface MyInterface { enum MyEnumType { Val1, Val2, Val3 }; extern MyString $std::string$; in MyEnumType myValuedEvent(MyString s); out void myReply(); behaviour { on myValuedEvent(s) : { reply MyEnumType.Val3; } } }
In this example a number of keywords are introduced:
interface
, in
, out
,
void
, behaviour
, on
, and reply
.
The example defines an interface named MyInterface
with two local types,
two events, and the interface behaviour (see below for a syntax description of events and behaviour).
An event has (in this order):
in
or out
),
void
if it is absent),
Some examples:
in void e2(); // a void in event called 'e2' with an empty parameter list in MyEnumType e3(); // a valued in event called 'e3' out void e4(MyString s); // a void out event called 'e4' with one data parameter
There is a restriction on event declarations: an out
event must be void
.
The behaviour
section of an interface contains the protocol description of the interface.
See Interface and Component Behaviour, for an elaborate description.