- 0 Talk
-
Events
The Events style of composition uses the ?? Operator. Ports of type Event are represented as
- Event EventName = boolean methodName(parameterlist)
Component EventTester{
Event Evt = boolean Trigger(int num);
//Event Evt = public boolean Trigger(int num);
//won't work - modifiers are not allowed
//Event Evt = void Trigger(int num);
//won't work - event return type cannot be void
//Event Evt = int Trigger(int num);
//won't work - event return type can only be boolean
Event Evt = boolean Trigger( );
Handler Hnd = int Processor(int number);
Sink Snk = void Pit(int finalnumber);
}
?? represents the event connector to implement the following compositions
* HandlerName ?? EventName
* SinkName ?? EventName
* ?? EventName
{
/* logic implementation */
}
In the first case, either of the following will then apply
- result = HandlerName ?? EventName
- conditional checking of returned values
In the third case, the value of the trapped event is returned in the form of __returnvalue which again may need to be type casted to the required type.
An example using the Events style of composition is given here.