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

DDSPSMC — Improving usability of EntityQoS API

  • Key: DDSPSMC-13
  • Legacy Issue Number: 16404
  • Status: closed  
  • Source: Real-Time Innovations ( Sumant Tambe)
  • Summary:

    8. Supporting method chaining for setting qos parameters would improve readability of the API.

    For instance,
    DataWriterQos dwqos;
    dw >> dwqos;
    Dwqos.policy<History>().kind(KEEP_ALL).depth(200);
    Dwqos.policy<ResourceLimits>().max_samples(p).max_instances(q).max_samples_per_instance(r);
    dw << dwqos;

    Currently, it needs different function calls for every qos parameter.

    Proposed Solution: Change all the normative core qos policy classes (e.g., History, ResourceLimits) to return a reference to itself from the setters. Currently they return nothing.

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

    The problem raised has been addressed by equipping all the Policy classes with fluent setter methods. The example provided by this issue can now written as follows:

    DataWriterQos dwqos;
    dw >> dwqos;
    dwqos << History::KeepAll(200)
    << dwqos.policy<ResourceLimits>()
    .max_samples(p)
    .max_instances(q)
    .max_samples_per_instance(r);

    dw << dwqos;

    The changes applied to the given policy class P is to have its setter return P&.
    See dds-psm-cxx/blob/master/src/hpp/dds/core/policy/TCorePolicy.hpp

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