-
Key: CORBA35-200
-
Legacy Issue Number: 5467
-
Status: open
-
Source: Floorboard Software ( Jonathan Biggar)
-
Summary:
I just noticed that the description of DynValue is totally silent on the
issue of derived valuetypes.Here's an example to set things up:
// IDL
valuetype A
{ public short s; };
valuetype B
{ public long l; };
struct S
{ A an_a; };
// C++
DynamicAny::DynFactory df = ...;
B *b = ...;
S my_s;
CORBA::Any my_any;s.an_a = b;
my_any <<= s;DynamicAny::DynAny_var da = df->create_dyn_any(my_any);
DynamicAny::DynStruct_var ds = DynamicAny::DynStruct::_narrow(da);ds->seek(0);
da = ds->current_component();DynamicAny::DynValue_var dv = DynamicAny::DynValue::_narrow(da);
CORBA::TypeCode_var tc = dv->type();cout << tc->id() << endl;
-----------
Now some questions:
1. What is printed by the above C++ code? "IDL:A:1.0" or "IDL:B:1.0"?
2. If the typecode is for valuetype A, what happens to the members
defined in valuetype B? Seems they must be inaccessable yet still
recoverable if I convert the DynValue back to an any and extract the
value, because I can't truncate a B to an A.3. If the typecode is for valuetype B, we now have the interesting case
where:tc->equivalent(ds->type()->member_type(0))
is false. Is this going to confuse programmers or programs? I think it
will, since it means that if I try to insert dv into another DynStruct
via assign() or the like, it will fail, since the TypeCodes are no
longer equivalent.4. Do the answers change if B is truncatable and the program can find
the TypeCode for B (perhaps via SendingContextRunTime)? How about if it
can't find the TypeCode? -
Reported: CORBA 3.0 — Tue, 16 Jul 2002 04:00 GMT
-
Updated: Thu, 11 Jan 2024 17:41 GMT
CORBA35 — How does DynValue handle derived valuetypes?
- Key: CORBA35-200
- OMG Task Force: CORBA 3.5 RTF