|
|
Multicast for Proxy Ports |
Rhapsody does not natively support multicasting of events through proxy ports. This simplifier provides that facility.
|
Applicable To |
N/A |
|
Menu
Entry |
N/A |
|
Demonstration |
This feature is not a traditional helper but is instead a code simplifier (these are explained in the Advanced section below). To enable the simplifier, set the following property to ByUserPostDefault on the active Component:
CPP_CG::Class::Simplify
In the sample model supplied there are two components:
· NoMulticastingSimplifier
Uses Rhapsody’s standard code generation. In this case Rhapsody generates code that will not compile (and in Rhapsody Systems Designer the model will not execute).
· MulticastingSimplifierEnabled
This component enables the Simplifier:

Enabling Multicasting at Port Level
In general, multicasting should be enabled for the appropriate proxy ports using the following property on those ports (or above them hierarchically).
CPP_CG::Port::SupportMulticast
Note that this property is enabled by default (so this property should already be set unless it has been overridden by the user)
Multiple patterns are supported (note that both Send Actions and OUT_PORT macros are supported)
Sent events are broadcast to all connected parts.



Sent events are broadcast to all externally connected parts.

Sent events are broadcast to all internally connected parts.

Rhapsody’s code generation architecture is a two-stage process. The first stage is the transformation of the user model into a simplified code model. It is simplified in the sense that it only contains primitives that are realizable in the target language. The second stage is the transformation of that simplified model into code. Code simplifiers are very powerful mechanisms that allow you to customize the way the code is generated by manipulating this simplified model before it is transformed into code.

By default, the simplified model is not visible to the user. Viewing the simplified model is not necessary for the functionality to work but may be of interest to the advanced user. To view the simplified model, set the following property to true:
CPP_CG::Configuration::ShowCgSimplifiedModelPackage
The next time code is generated the simplified model will be shown in the model browser:

The Multicast for Proxy Ports simplifier searches the simplified model for the ‘send’ operations that Rhapsody generates to allow the multicasting of events through a port:

The original Rhapsody-generated code for these operations sends each event in the port to one target only:

The simplifier modifies this code to send events to all connected targets using a for-loop defined in a template in the following property:
RhapsodyPowerPack.MulticastForProxyPorts.SendTemplate
if(event->isTypeOf($eventID$)) {
$eventParametersPointer$
for
(int i = 0; i < its$eventNameCapital$_ProxyReceptionInterface.getCount();
i++)
{
res
= its$eventNameCapital$_ProxyReceptionInterface[i]->send(new $eventName$($eventParameters$)$params$);
if(res==false)
break;
}
}
(the simplifier helper replaces the $xxx$ parameters with the details of the event(s) to be sent through the port).

Note that this also requires the following property to be set (this is set on the Rhapsody Power Pack Profile. This ensures Rhapsody code generation uses OUT_PORT (compatible with the simplifier) instead of MULTICAST_GEN (which only works for standard ports)
