-
Key: PYTH12-9
-
Legacy Issue Number: 4316
-
Status: closed
-
Source: Raytheon ( Craig Rodrigues)
-
Summary:
I'd like to point out some errors in the Python Language Mapping
document, ftp://ftp.omg.org/pub/docs/formal/01-02-66.pdf,
section 1.3.9 "Mapping for an Any".The example which accompanies the text for this section
is vague, contains errors, and is confusing to someone who
is trying to learn how to use Anys in the Python Language Mapping.
For discussion of some of the errors in this example, refer to
the following messages on the omniORB mailing list:
http://www.uk.research.att.com/omniORB/archives/2001-04/0139.html
http://www.uk.research.att.com/omniORB/archives/2001-04/0140.htmlI believe the example is broken in many ways, and should
be re-written to more clearly illustrate how to use Anys
with the Python Language Mapping.I have re-written the example as follows:
========================================================================
import CORBA
import M- Create a value of type M.S
v = M.S(1, CORBA.TRUE) - obtain type code
tc=CORBA.TypeCode( CORBA.id(M.S) ) - could also use: tc1=CORBA.TypeCode("IDL:M/S:1.0")
- Create any containing an M.S object
any1 = CORBA.Any(tc, v)
-
- the TypeCodes for the basic CORBA types are defined
- in the CORBA 2.4 standard, section 10.7.2 "TypeCode Constants"
- Create any containing CORBA Long
any2 = CORBA.Any(CORBA.TC_long, 1) - Create any containing CORBA Float
any3 = CORBA.Any(CORBA.TC_float, 3.14) - Create any containing CORBA Float
any4 = CORBA.Any(CORBA.TC_short, 5) - Create any containing CORBA unsigned
any5 = CORBA.Any(CORBA.TC_ushort, 6) - Create any containing CORBA String
any6 = CORBA.Any(CORBA.TC_string, "some string")
o = something() # somehow obtain reference to object of type M.foo
o.operate( any1 )
o.operate( any2 )
o.operate( any3 )
.
.
.========================================================================
I believe that it is imperative that this example be changed in
Section 1.3.9 of the Python Language Mapping. - Create a value of type M.S
-
Reported: PYTH 1.1 — Mon, 21 May 2001 04:00 GMT
-
Disposition: Duplicate or Merged — PYTH 1.2
-
Disposition Summary:
Duplicate of issue # 4315
-
Updated: Sat, 7 Mar 2015 06:07 GMT