Using rapid ports

The product supports rapid ports: you can simply draw ports, connect them through links, create a statechart, and the ports exchange events without any additional information. In addition, if a port is not connected to any of the internal parts for a class, the code generator assumes that it is a behavioral port and messages are relayed to or from the class. In rapid mode, the classes must be reactive because Rhapsody® assumes that events are exchanged.

About this task

Rapid ports would be useful in the following situations:

  • In component-based design. For example, when you have a class to be reused in different systems and has a behavior of its own (not that of one of its parts) that provides and requires the interfaces of the contract for the port.
  • The class has a statechart in which the triggers of the transitions are based on the ports through which the events were received. In other words, because the statechart is able to distinguish between the ports through which an event was sent, it could react differently to the same events based on which port the event came from.
Note: Once you specify the contract on a port, you must specify the contract on all the ports that are connected to it. Otherwise, the code generator sends a warning that there is a mismatch in the contracts and the links are not created.

Rhapsody uses the values of the following framework properties to implement the rapid ports:

  • DefaultProvidedInterfaceName specifies the interface that must be implemented by the "in" part of a rapid port.
  • DefaultReactivePortBase stores the base class for the generic rapid port (or default reactive port). This base class relays all events
  • DefaultRequiredInterfaceName specifies the interface that must be implemented by the "out" part of a rapid port
  • DefaultReactivePortIncludeFile specifies the include files that are referenced in the generated file that implements the class with the rapid ports

Consider the following figure, which shows an object model diagram that uses rapid ports.

Object model diagram that uses rapid ports