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

DDSPSMC — Expected use of AnyDataReader::get and its implication on AnyDataReader's template constructor

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

    AnyDataReader::get is a member template function, which requires passing a type to retrieve a typed data-reader. For example,

    AnyDataReader adr;
    DataReader<RadarTrack> dr = adr.get<RadarTrack>();

    It is better to pass the topic type instead of the data-reader type. For example,

    AnyDataReader adr;
    DataReader<RadarTrack> dr = adr.get<dds::sub::DataReader<RadarTrack> >();

    The first version is less error prone.

    Construction of AnyDataReader, however, does not look consistent with this use. Currently, the template constructor of the AnyDataReader accepts a data-reader as a type parameter (not just the topic type).

    Also, it is not consistent with AnyDataWriter constructor, which takes topic type as a type parameter.

    Resolution: Use the style of AnyDataWriter in AnyDataReader, AnyTopic, and AnyTopicDescription. I.e., Use the topic type as a type parameter for constructor and get() member function.

  • Reported: DDS-PSM-Cxx 1.0b1 — Fri, 9 Dec 2011 05:00 GMT
  • Disposition: Resolved — DDS-PSM-Cxx 1.0b2
  • Disposition Summary:

    The AnyDataWriter in AnyDataReader, AnyTopic, and AnyTopicDescription now use consistently the topic type as a type parameter for constructor and get() member function. Free function get() have also been added to avoid exotic C++ syntax under some circumstances.

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