To allow use of the multiple address space feature, different
code generation settings are required.
These settings are controlled by the following property:
- C_CG::Configuration::MultipleAddressSpaces
When
this Boolean property is set to Checked, IBM® Rational® Rhapsody® uses
the code generation settings required for use of the multiple address
space feature. The default value of this property is Cleared,
so you must change the value to enable this feature.
In order to be able to receive events from other
address spaces, the reactive object must publish the name by which
it will be identified. The following two properties, set at the class
level, are used for this purpose:
- C_CG::Class::PublishedName This
is the name that will be used to identify the reactive object in order
to send a distributed event to it.
If there is only one
reactive instance of the class, the value of this property is used
to identify the object.
If there is more than one reactive
instance of the class, each named explicitly, the name used to identify
the reactive object will be the name that you have given to the object,
and not the property value.
In the case of multiplicity,
where the objects are not named explicitly, the name used to identify
the reactive object will be the published name + the index of the
object, for example, if the value of the PublishedName property
is truck, then the objects would be identified by truck[0],
truck[1].
- C_CG::Class::PublishInstance
This
Boolean property indicates whether the object publishes as a reactive
instance that is capable of receiving distributed events.
In addition, you can use the following property,
which is set at the configuration level, to specify a specific target
address space when sending events, as described in API for sending events across address spaces:
- C_CG::Configuration::AddressSpaceName
When
you want to send an event to a reactive object in a specific address
space, you specify the address space by using the value of this property
as a prefix, using the format addressSpaceName::publishedNameOfReactiveObject.
The default value of this property is the name of the relevant component.
If the events to be sent across address spaces have
no arguments or only primitive types as arguments, such as integers
or chars, it is sufficient to set the previously mentioned properties.
However, if the events to be sent include objects as arguments, you
must also set the following properties at the event level:
- C_CG::Event::SerializationFunction Name
of user-provided serialization function to use
- C_CG::Event::UnserializationFunction Name
of user-provided unserialization function to use
For details regarding the required structure for
these two user-provided functions, see Functions for serialization and unserialization.