DDS-XTypes 1.4 RTF Avatar
  1. OMG Issue

DDSXTY14 — Clarify accessing discriminator of a DynamicData union

  • Key: DDSXTY14-59
  • Status: open  
  • Source: Object Computing, Inc. - OCI ( Adam Mitz)
  • Summary:

    It's not clear how a user of a DynamicData object that represents a union gets the discriminator value. We derive the following:

    // see pgh 1 of 7.2.2.4.4.3 for use of "discriminator" as a magic string
    const MemberId id_disc = dyndata->get_member_id_by_name("discriminator"); 
    if (id_disc == MEMBER_ID_INVALID) { some error happened }
    // based on union_type_descriptor.discriminator_type->get_kind(), determine the type of the discriminator
    // in this example, let's say it's an IDL long
    int val;
    dyndata->get_int32_value(val, id_disc);
    

    It would be better for the spec to have a clearly defined way of getting a MemberId that represents the discriminator. It could be a new API in DynamicType or TypeDescriptor.

  • Reported: DDS-XTypes 1.3 — Mon, 8 Aug 2022 15:38 GMT
  • Updated: Thu, 8 Dec 2022 16:04 GMT