Send action
A send action usage is declared as an action usage whose behavior is to transfer the payload from the sender to the receiver. It has three input parameters:
- A set of payload values, identified by the send keyword.
- A sender occurrence, identified by the via keyword.
- A receiver occurrence, identified by the to keyword.
Sending context
A send action usage can specify both a sender (via) and receiver (to), but it will generally give only one or the other:
- If a send action usage is directly or indirectly a composite feature of a part definition or usage, then the default for the sender (via) of the send action usage is the containing part.
- If a send action usage is not a composite feature of a part definition or usage, then the default for the sender (via) of the send action usage is the highest-level containing action usage.
- If a send action usage is contained by a perform action, then the default for the sender (via) of the send action usage is the perform action, not the part or the higher-level action.
- If sending through a port, the port usage will usually be the sender (via). The receiver (to) is then determined by the port interface connection.
Specifying send actions for actions
Specifying send actions for actions via the Textual Editor
To specify send actions for actions via the Textual Editor
In the Textual Editor, place the cursor where you want to create the send action and do one of the following:
- For a named send action usage, declare the keyword action, specify the element name, and then the keyword send.
- For an unnamed send action usage, declare the keyword send.
- Follow with the expression for the payload.
- Follow with the needed option(s):
- Specify the via keyword and the expression for the sender.
- Specify the to keyword and the expression for the receiver.
- Click the Synchronize button.
// ------------ sending without ports; the sender is the part 'camera', the receiver is the part 'screen'
part camera : Camera {
action takePicture : TakePicture {
action trigger accept scene : Scene;
then action focus : Focus {
in scene = trigger.scene;
out image;
}
flow focus.image to shoot.image;
then action shoot : Shoot {
in image;
out picture;
}
// named send action 'displayPicture' transferring the payload 'shoot.picture' from the sender 'camera' to the receiver 'screen':
then action displayPicture send shoot.picture to screen;
// unnamed send action usage:
then send shoot.picture to screen;
}
}
// ------------ sending through ports; the sender is the port 'displayPort'
part camera : Camera {
port viewPort;
port displayPort;
action takePicture : TakePicture {
action trigger accept scene : Scene via viewPort;
then action focus : Focus {
in scene = trigger.scene;
out image;
}
flow focus.image to shoot.image;
then action shoot : Shoot {
in image;
out picture;
}
// named send action 'displayPicture' transferring the payload 'shoot.picture' from the sender 'displayPort':
then action displayPicture send shoot.picture via displayPort;
// unnamed send action usage:
then send shoot.picture via displayPort;
}
}
Specifying send actions for actions via the view palette
To specify send actions for actions via the view palette
- In the view palette, under the Other Actions group, click the send button to create a send action usage element.
- Click on an action symbol in the view pane where you want to create the send symbol.
- (Optional) Specify the element's parameters via the Textual Editor.