Issue 16885: Expected use of AnyDataReader::get and its implication on AnyDataReader's template constructor (dds-psm-cxx-ftf) Source: Real-Time Innovations (Dr. Sumant Tambe, sumant(at)rti.com) Nature: Enhancement Severity: Significant 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. Resolution: Revised Text: Actions taken: December 9, 2011: received issue Discussion: End of Annotations:===== m: webmaster@omg.org Date: 09 Dec 2011 21:50:29 -0500 To: Subject: Issue/Bug Report ******************************************************************************* Name: Sumant Tambe Employer: Real-Time Innovations mailFrom: sumant@rti.com Terms_Agreement: I agree Specification: DDS-PSM-CXX Section: 7 FormalNumber: ptc/2011-01-02 Version: FTF Beta 1 Doc_Year: 2010 Doc_Month: January Doc_Day: 01 Page: 40 Title: Expected use of AnyDataReader::get and its implication on AnyDataReader's template constructor Nature: Enhancement Severity: Significant CODE: 3TMw8 B1: Report Issue Description: AnyDataReader::get is a member template function, which requires passing a type to retrieve a typed data-reader. For example, AnyDataReader adr; DataReader dr = adr.get(); It is better to pass the topic type instead of the data-reader type. For example, AnyDataReader adr; DataReader dr = adr.get >(); 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.