I use DynamicData to build a TypeCode for a topic called "Track", and one of its member "Location" is a struct.When the Track topic is created, the Location field and its members are populated with default values. Is there a way to set this Location struct to null?
Something like this:
dynamicData.set_complex_member("Location", "1", null);
But this doesn't work, it throws an exception.
Thank you!!
Gary
Hi Gary,
Did you declare the "Location" member as
//@Optional
in the IDL file? I think is required to indicate that the member may be NULL.See the Optional Members section in the Connext DDS 5.0 Extensible Types Addendum for details.
Alternatively if you are using the TypeCode to dynamically define the data-type then you would need to set the StructMember
is_optional
attribute to TRUE when you are defining the Location member.Gerardo