IDL4-CPP 1.0b2 FTF Avatar
  1. OMG Issue

IDL4CPP — a_short in example code

  • Key: IDL4CPP-5
  • Status: closed  
  • Source: Remedy IT Expertise BV ( Johnny Willemsen)
  • Summary:

    In the example code it lists
    const int16_t& a_short()

    {...}
    but shouldn't that be
    int16_t a_short() const {...}

    This should be a return by value, using `const int16_t` will lead to a compiler warning, so it should be 'int16_t', all accessors should be checked.

  • Reported: IDL4-CPP 1.0b1 — Thu, 23 Mar 2023 14:10 GMT
  • Disposition: Resolved — IDL4-CPP 1.0b2
  • Disposition Summary:

    Update mapping of a_short in example code

    Accessors for members of the union for which the mapped type results in primitive types and enums shall return by value. Therefore, the updated example reflects that:

    // ...
    void a_long(int32_t value) {...}
    int32_t a_long() const {...}
    // ...
    

    The updated example also includes members that result in non-primitive types like strings or structs.

    As part of the resolution of this issue we also provide a method to set the discriminator to a specific legal value when the union definition has an implicit default member (the current mapping only provides a _default() that sets the discriminator to a legal default value).

    We also mandate that non-primitive members provide two getters:

    const Foo& a_foo() const {}
    Foo& a_foo() {}
    

    and primitive members the following two getters:

    int16_t a_long() const {}
    int16_t& a_long() {}
    

    If the getter selects a branch that does not match the discriminator value, the getter should throw an error.

  • Updated: Mon, 16 Sep 2024 14:15 GMT