Protocols in an RTist model are often binary, meaning that there are two connected ports typed by the protocol. The out-events for one of the ports are the in-events for the other port.

This is expressed by making one of the ports conjugated (denoted by ~). Hence, for a conjugated port the direction of protocol events is swapped so that the out-events can be sent in and the in-events sent out from it.

Conjugated Ports

 

A binary protocol MyProtocol typing two connected ports p1 and p2. The event that can be sent out from p1 (OutEvent1) can be sent in to p2, and the event that can be sent in to p1 (InEvent1) can be sent out from p2. The port p2 is therefore conjugated to swap the event directions specified in the protocol.

In the above example, it doesn’t matter which of the ports that are conjugated. However, when you are modeling a client-server design, a useful recommendation is to conjugate the server ports rather than the client ports.

Even if the opposite also works, you get two benefits by following this recommendation:

  1. All events that are sent from the client to the server are out-events, and all events that are sent from the server to the client are in-events. This makes send- and invoke-statements in the client capsule easy to read. Communication in client-server designs is usually initiated by clients rather than the server.
  2. There are typically more client ports than server ports, so by choosing to conjugate the server ports you save some clicking in the Properties view.

 

Client Server Design

 

A client-server design with 1 server port and 2 client ports. The client ports are named according to the server to make send- and invoke-statements in the client capsules easy to read.

If you want to change which ports that are conjugated, you also need to swap the directions of all events in the protocol of those ports. RTist provides a handy command for doing this. Select all events in the protocol, right-click and choose the command Change Event Direction. All in-events will become out-events and vice versa.

Comment wrap
Further Reading
article-img
Secure DevOps | September 2, 2022
RTist 11.2 2022.34
HCL RTist is a rule-based code translator for C/C++. The main feature of RTist is to produce readable, maintainable, and portable code.
article-img
Secure DevOps | November 29, 2021
What’s new in HCL RTist 11.1 2021.46
Today we ship another release of HCL RTist: 11.1 2021.46. As usual, there are several new features and a few bug fixes. Let's look at some of the highlights.
article-img
Secure DevOps | November 9, 2021
Writing a generic type descriptor with HCL RTist
Starting with HCL RTist 11.1 2021.24 it's now possible to write a generic type descriptor that uses the same template parameters as the type. This can save a lot of time and avoid code duplication.
Close
Filters result by
Sort:
|