DDS-PSM-Cxx 1.1 RTF Avatar
  1. OMG Issue

DDSPSMC11_ — EntityQos is overly general

  • Key: DDSPSMC11_-65
  • Legacy Issue Number: 18445
  • Status: open  
  • Source: Real-Time Innovations ( Sumant Tambe)
  • Summary:

    EntityQos template is a rather overly general way of setting and getting policies. Member template functions generate the code depending upon the policy type. If you pass a wrong type, it eventually ends up showing a link-time error as opposed to a compile-time error. For instance, there is a link-time error in the code below because DataWriterQos has no presentation policy.

    dds::pub::qos::DataWriterQos dwqos;
    dds::core::policy::Deadline d;
    dds::core::policy::Presentation p;
    dwqos >> p; /// Linker error here. No compile-time error
    dwqos >> d; /// Fine!

    Additionally, the dot operator provides no help for syntax completion because the policy function is a member template. Consequently, the end-user might be tempted to use the -> operator, which does provide syntax completion depending upon the implementation of the delegate. As a result, for standard policies -> will be used, which is unintended.

    Proposed Resolution:

    1. Add template classes DataReaderQos, DataWriterQoS, PublisherQos, SubscriberQos, DomainParticipantQos in the dds namespace.

    2. Support non-template member functions for setting and getting respective policies. For instance. dwqos.deadline() and dwqos.deadline(d) should be supported.

    3. Define operator << and operator >> outside the QoS class and overload for the respective policies.

    4. The templated verions of policy getters/setters can still be supported. However, I seriously doubt their usefulness. If we decide to keep them, at least I would like to turn the linker error into compiler error using a meta-programming technique described here:

  • Reported: DDS-PSM-Cxx 1.0b2 — Tue, 12 Feb 2013 05:00 GMT
  • Updated: Sun, 30 Sep 2018 23:30 GMT