We're using union types with a Boolean discriminator. When the discriminator is true, the 'value' field contains valid data. When false, there is no valid data.
The problem is that the rtiddsprototyper defaults the discriminator to 'true', which means the value field should have valid data. We have the same problem with code generated from the rtiddsgen tool: the default discriminator value is 'true'. The documentation I've seen explains that the discriminator changes when setting the appropriate member of the union. But with these Boolean discriminators, there is no union member that corresponds to 'false'. Is there any way to use the rtiddsprototyper (with or without lua) to set the discriminator of these union types to 'false'?
<union name="request_ack_rejection_type"> <discriminator type="boolean"/> <case> <caseDiscriminator value="true"/> <member name="value" type="nonBasic" nonBasicTypeName= "org::omg::c4i::Domain_Model::Common_Types::Requests::denial_type"/> </case> </union>
But I think that a better solution for your use case is to use the "@optional" annotation...which basically turns the member into a pointer. And if you set the value of the member value on sending, the DataReader receives the value (via a pointer member).
If you don't set the member (or set the pointer to NULL), then the DataReader will receive a NULL pointer for the member, which you can check for...the type definition would look something like this:
Thank you again, Howard. I can try to update the XML.
All of these issues are from the OMG's OARIS specification. I can submit these issues to the OMG about the specification, but I am hesitant to edit the IDL from a standard.