Issue 1984: Generic extraction of Fixed (cxx_revision) Source: (, ) Nature: Uncategorized Issue Severity: Summary: Summary: The C++ mapping does not permit extraction of a Fixed from an Any in a generic way -- I must always specify matching digits and scale in order to call Any::to_fixed(). This is inconvenient if an application wants to deal with Fixed values generically (because Fixed is a generic type in C++ anyway). Proposal: Add an overloaded >>= operator for extraction of Fixed from an Any. The operator sets the Fixed value to whatever scale and digits are present in the type code. Cheers, Michi. Resolution: Revised Text: Actions taken: September 22, 1998: received issue Discussion: deferred in June 2011 to the next RTF End of Annotations:===== >Return-Path: X-Authentication-Warning: fatcat.dstc.edu.au: michi owned process doing -bs Date: Tue, 22 Sep 1998 14:28:38 +1000 (EST) From: Michi Henning To: issues@omg.org, cxx_revision@omg.org Subject: Generic extraction of Fixed The C++ mapping does not permit extraction of a Fixed from an Any in a generic way -- I must always specify matching digits and scale in order to call Any::to_fixed(). This is inconvenient if an application wants to deal with Fixed values generically (because Fixed is a generic type in C++ anyway). Proposal: Add an overloaded >>= operator for extraction of Fixed from an Any. The operator sets the Fixed value to whatever scale and digits are present in the type code. Cheers, Michi. Return-Path: X-Envelope-From: olivers@cix.co.uk Date: Tue, 20 Oct 1998 22:41 +0100 (BST) From: olivers@cix.co.uk (Oliver Sims) Subject: Re: Generic extraction of Fixed To: issues@omg.org CC: michi@dstc.edu.au Reply-To: olivers@cix.co.uk On Tue, 22 Sep 1998, Michi Henning wrote: > > The C++ mapping does not permit extraction of a Fixed from an Any > in a generic way -- I must always specify matching digits and scale > in > order to call Any::to_fixed(). This is inconvenient if an > application > wants to deal with Fixed values generically (because Fixed is a > generic > type in C++ anyway). We have omitted the fixed type from our Tagged Data proposal precisely because it is impossible (as I understand it) to deal with the fixed type in a generic way. I think this should be corrected ASAP. I'd be glad to discuss possible solutions at Burlingame. Anyone interested? Regards, Oliver -- Oliver Sims Principal Architect olivers@cix.compulink.co.uk SSA Object Technology Tel: +44 1635-522600 Albion House, Oxford Street Fax: +44 1635-522602 Newbury, Berks. RG14 1JE, UK Return-Path: Sender: jon@floorboard.com Date: Tue, 20 Oct 1998 15:43:42 -0700 From: Jonathan Biggar X-Accept-Language: en CC: cxx-revision@omg.org Subject: Re: Generic extraction of Fixed References: Oliver Sims wrote: > > The C++ mapping does not permit extraction of a Fixed from an Any > > in a generic way -- I must always specify matching digits and > scale in > > order to call Any::to_fixed(). This is inconvenient if an > application > > wants to deal with Fixed values generically (because Fixed is a > generic > > type in C++ anyway). > > We have omitted the fixed type from our Tagged Data proposal > precisely because > it is impossible (as I understand it) to deal with the fixed type in > a generic > way. I think this should be corrected ASAP. > > I'd be glad to discuss possible solutions at Burlingame. Anyone > interested? It's not impossible, just a little more difficult. The new C++ mapping that will appear in Corba 2.3 redefined fixed to be a non-template type that can hold any fixed value, and has a to_fixed helper structure that requires that the digits and scale match what is in the any. This is inconvenient, but not a showstopper, since the any's TypeCode also contains the digits and scale, which can be extracted and passed as arguments to to_fixed. With these changes, which you probably haven't seen yet, you should be able to deal with fixed in a generic way in C++. -- Jon Biggar Floorboard Software jon@floorboard.com jon@biggar.org Return-Path: X-Authentication-Warning: azure.dstc.edu.au: michi owned process doing -bs Date: Wed, 21 Oct 1998 08:45:30 +1000 (EST) From: Michi Henning To: Jonathan Biggar cc: olivers@cix.co.uk, cxx_revision@omg.org Subject: Re: Generic extraction of Fixed On Tue, 20 Oct 1998, Jonathan Biggar wrote: > It's not impossible, just a little more difficult. The new C++ mapping > that will appear in Corba 2.3 redefined fixed to be a non-template type > that can hold any fixed value, and has a to_fixed helper structure that > requires that the digits and scale match what is in the any. This is > inconvenient, but not a showstopper, since the any's TypeCode also > contains the digits and scale, which can be extracted and passed as > arguments to to_fixed. > > With these changes, which you probably haven't seen yet, you should be > able to deal with fixed in a generic way in C++. Yes, Jon is right of course. I raised this issue mainly because it would be convenient to be able to deal with fixed values generically -- it would save me having to jump through the hoops of fiddling with the type code to extract a fixed value. Cheers, Michi. -- Michi Henning +61 7 33654310 DSTC Pty Ltd +61 7 33654311 (fax) University of Qld 4072 michi@dstc.edu.au AUSTRALIA http://www.dstc.edu.au/BDU/staff/michi-henning.html Date: Mon, 28 May 2001 15:39:26 +1000 (EST) From: Michi Henning Reply-To: C++ Revision Task Force To: C++ Revision Task Force Subject: Proposal for 1984 Message-ID: Organization: IONA Technologies MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-UIDL: mo7e9"Q*!!48$"!N)9!! Status: RO The mapping does say what should happen if I insert a Fixed into an Any and the digits and scale given to from_any() don't match what's in the Fixed value. Rather than introducing some default rounding/padding/truncation rule, I'd like to make it explicit that insertion into an Any with from_Fixed() requires matching digits and scale (just as the proposal does for 1983 for extraction). However, Fixed is a bit different from bounded strings in its usage pattern. in particular, the type of a Fixed value can change unpredictably at run time as a result of computations performed on the value, so there really is a need for generic insertion and extraction. Proposal: - On page 1-53, add Fixed to the list of types in the first bullet point. - On page 1-54, add the following bullet point to the list of bullet points introduced with "Setting a value in an any using operator<<= means that:" - Inserting a Fixed value into an Any sets the digits and scale values of the Any's TypeCode to match the inserted Fixed value. - On page 1-57, add Fixed to the list of types in the first bullet point - On page 1-57, bottom of page, add a new para immediately preceding footnote 14: Extraction with operator>>= for type Fixed sets the digits and scale of the extracted Fixed value to match the digits and scale of the Any's TypeCode. - Change the heading of section 1.16.4 to read: Distinguishing boolean, octed, char, wchar, bounded string, bounded wstring, and fixed. (The fixed type was missing from the heading.) - Add the following para prior to the para proposed for issue 1983: For successful insertion of Fixed values with from_fixed, the digits and scale values supplied to the constructor must match those of the Fixed value; otherwise, the constructor fails and the TypeCode of the Any is set to tk_null. - Add the following to the Any class in section 1.41.5: void operator<<=(Any&, Fixed); Boolean operator>>=(const Any&, Fixed&); Cheers, Michi. -- Michi Henning +61 7 3324 9633 Chief CORBA Scientist +61 4 1118 2700 (mobile) IONA Technologies +61 7 3324 9799 (fax) Total Business Integration http://www.ooc.com.au/staff/michi