Consider replacing @Choice annotation with XTYPES 1.2 unions
Source: Twin Oaks ( Clark Tucker)
The DDS-RPC added a @Choice annotation (see 18.104.22.168.1.1 @Choice Annotation) to indicate a Structure with the "single-member" semantics of a union. As stated in the aforementioned section the reason was:
Using unions to indicate which operation is being invoked is brittle. Operations in an interface have set semantics and have no ordering constraints. Union, however, enforces strict association with discriminator values, which are too strict for set semantics. Further, use of unions leads to ambiguities in case of multiple inheritance of interfaces.
However XTYPES 1.2 enhanced unions which now support inheritance and are not so brittle anymore. For this reason it makes sense to re-evaluate this decision.
An advantage of using unions (beyond avoiding a extraneous annotation) is that their API is better oriented to identifying the one branch that is present; whereas in the case of structures there is no standard API available to determine which member is present other than iterating over every member. This would be unnatural for processing the RPC calls.
Reported: DDS-RPC 1.0 — Tue, 24 Sep 2019 13:26 GMT
Updated: Tue, 24 Sep 2019 13:26 GMT