DDS-PSM-Cxx 1.0b2 FTF Avatar
  1. OMG Issue

DDSPSMC — IDL mapping for non-trivial struct fields

  • Key: DDSPSMC-19
  • Legacy Issue Number: 16565
  • Status: closed  
  • Source: Northrop Grumman ( Trent Nadeau)
  • Summary:

    The “representative” example in Section 8.2 is not very “representative”. For example, everything in the struct can be trivially returned by value (either a basic type or a pointer) with no impact on performance.

    If, instead, there were a substructure that was large and/or deeply nested, this example seems to break down. For example:

    typedef sequence<long, 1000000> HugeLongSeq; // 4 MB

    struct LargeStruct

    { long id; HugeLongSeq mySeq; }


    struct RadarTrack

    { string id; long x; long y; long z; //@optional sequence<octet> plot; //@shared LargeStruct myLargeMember; // new field }


    According to Section 7.4, the return value of the accessor for myLargeMember would either return by value or const reference. This would cause two copies (one for return value of getter and another for setter) of 4 MB of data in order to change one element of LargeStruct::mySeq in the instance.

    I believe that use cases like this require accessors that return by non-const reference if the generated code is to be at all efficient. On page 17 of the Beta 1 spec, there is already use of this pattern for the non-const accessors on the History class (where it probably makes less sense since the types are small). I believe that this pattern should also be used for generated code where many large types can be arbitrarily nested.

  • Reported: DDS-PSM-Cxx 1.0b1 — Fri, 23 Sep 2011 04:00 GMT
  • Disposition: Resolved — DDS-PSM-Cxx 1.0b2
  • Disposition Summary:

    This issue can be easily fixed by ensuring that constructed and sequence types have a reference return type as opposed to a const reference.

  • Updated: Fri, 6 Mar 2015 20:58 GMT