Issue 14169: make it possible to write more generic C++ code (cxx_revision) Source: Remedy IT (Mr. Johnny Willemsen, jwillemsen(at)remedy.nl) Nature: Clarification Severity: Minor Summary: The spec defines: // C++ class Seq_var; class Seq { public: typedef Seq_var _var_type; // ... }; We propose to extend this to the following to make it possible to write more generic C++ code. // C++ class Seq_var; class Seq_out; class Seq { public: typedef Seq_var _var_type; typedef Seq_out _out_type: typedef ::CORBA::ULong _size_type; // ... }; Resolution: In section 4.11 add to the example at the end Seq_out and a _out_type typedef as in the revised text below. The _size_type typedef will make it possible in the user code to differentiate between the index of a sequence type and a user defined ULong value. To section 4.15 add the sentence To facilitate template-based programming, a nested public typedef _size_type is delivered as the type representing the length of the sequence. And to the sequence class examples in section 4.15 the following typedef ULong _size_type; Revised Text: To facilitate template-based programming, all struct, union, and sequence classes contain nested public typedefs for their associated T_var and T_out types. For example, for an IDL sequence named Seq, the mapped sequence class Seq contains a _var_type and _out_type typedef as follows: // C++ class Seq_var; class Seq_out; class Seq { public: typedef Seq_var _var_type; typedef Seq_out _out_type; // ... }; Revised Text for 4.15: For each different typedef naming an anonymous sequence type, a compliant mapping implementation provides a separate C++ sequence type. To facilitate template-based programming, a nested public typedef _size_type is delivered as the type representing the length and maximum of the sequence. For example: // IDL typedef sequence<long> LongSeq; typedef sequence<LongSeq, 3> LongSeqSeq; // C++ class LongSeq // unbounded sequence { public: typedef ULong _size_type; LongSeq(); // default constructor LongSeq(ULong max); // maximum constructor LongSeq( // T *data constructor ULong max, ULong length, Long *value, Boolean release = FALSE); LongSeq(const LongSeq&); ~LongSeq(); ... }; class LongSeqSeq // bounded sequence { public: typedef ULong _size_type; LongSeqSeq(); // default constructor LongSeqSeq( // T *data constructor ULong length, LongSeq *value, Boolean release = FALSE); LongSeqSeq(const LongSeqSeq&); ~LongSeqSeq(); ... }; Actions taken: July 31, 2009: received issue January 11, 2012: closed issue Discussion: End of Annotations:===== m: webmaster@omg.org Date: 31 Jul 2009 09:11:21 -0400 To: Subject: Issue/Bug Report -------------------------------------------------------------------------------- Name: Johnny Willemsen Company: Remedy IT mailFrom: jwillemsen@remedy.nl Notification: Yes Specification: CORBA C++ mapping Section: 4.11 FormalNumber: 08-01-09 Version: 1.2 RevisionDate: Jan 2008 Page: 33 Nature: Clarification Severity: Minor HTTP User Agent: Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US; rv:1.9.1.1) Gecko/20090715 Firefox/3.5.1 (.NET CLR 3.5.30729) Description The spec defines: // C++ class Seq_var; class Seq { public: typedef Seq_var _var_type; // ... }; We propose to extend this to the following to make it possible to write more generic C++ code. // C++ class Seq_var; class Seq_out; class Seq { public: typedef Seq_var _var_type; typedef Seq_out _out_type: typedef ::CORBA::ULong _size_type; // ... };