Issue 18445: EntityQos is overly general (dds-psm-cxx-rtf) Source: (Dr. Sumant Tambe, nobodysumant(at)rti.com) Nature: Enhancement Severity: Significant 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: http://cpptruths.googlecode.com/svn/trunk/cpp/entityqos.cpp Resolution: Revised Text: Actions taken: February 12, 2013: received issue Discussion: End of Annotations:===== m: webmaster@omg.org Date: 12 Feb 2013 15:07:15 -0500 To: Subject: Issue/Bug Report ******************************************************************************* Name: Sumant Tambe Employer: Real-Time Innovations mailFrom: sumant@rti.com Terms_Agreement: I agree Specification: DDS CXX PSM RTF Section: 7 FormalNumber: ptc/12-10-01 Version: 1 Doc_Year: 2012 Doc_Month: December Doc_Day: 01 Page: 1 Title: EntityQos is overly general Nature: Enhancement Severity: Significant CODE: 3TMw8 B1: Report Issue Description: 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: http://cpptruths.googlecode.com/svn/trunk/cpp/entityqos.cpp