<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type">
<title></title>
</head>
<body bgcolor="#ffffff" text="#000000">
<div class="moz-text-plain" wrap="true" graphical-quote="true"
style="font-family: -moz-fixed; font-size: 20px;" lang="x-western">
<pre wrap="">Duncan Grisby wrote:
</pre>
<blockquote type="cite" style="font-size: large;">
<pre wrap=""><span class="moz-txt-citetags"></span>On Saturday 9 April, Renzo Tomaselli wrote:
<span class="moz-txt-citetags">></span>
</pre>
<blockquote type="cite" style="font-size: large;">
<pre wrap=""><span class="moz-txt-citetags">>> </span> it appears that is not possible to transport a fully qualified nil
<span class="moz-txt-citetags">>></span>object reference within an any generated by pyhon.
<span class="moz-txt-citetags">>></span>For a given interface Folder, we can build an any containing a nil
<span class="moz-txt-citetags">>></span>reference by:
<span class="moz-txt-citetags">>></span>
<span class="moz-txt-citetags">>></span>any = CORBA.Any(CORBA.TypeCode(CORBA.id(Folder)), Folder._nil)
<span class="moz-txt-citetags">>></span>
<span class="moz-txt-citetags">>></span>and fetch it on a C++ server side as:
<span class="moz-txt-citetags">>></span>
<span class="moz-txt-citetags">>></span>CORBA::Object_ptr obj;
<span class="moz-txt-citetags">>></span>any >>= CORBA::Any::to_object(obj);
<span class="moz-txt-citetags">>></span>
<span class="moz-txt-citetags">>></span>However, while the transported typecode appears to be a Folder, the
<span class="moz-txt-citetags">>></span>fetched obj is a generic CORBA::Object::_nil() and not a
<span class="moz-txt-citetags">>></span><a
class="moz-txt-link-freetext" href="Folder::_nil%28">Folder::_nil(</a>).
</pre>
</blockquote>
<pre wrap=""><span class="moz-txt-citetags">></span>
<span class="moz-txt-citetags">></span>
<span class="moz-txt-citetags">></span>How can you tell? The only supported operation on nil object references
<span class="moz-txt-citetags">></span>is to call CORBA::is_nil, so it doesn't matter what kind of nil you
<span class="moz-txt-citetags">></span>have.
<span class="moz-txt-citetags">></span>
<span class="moz-txt-citetags">></span>What are you actually trying to do?
<span class="moz-txt-citetags">></span>
<span class="moz-txt-citetags">></span>Cheers,
<span class="moz-txt-citetags">></span>
<span class="moz-txt-citetags">></span>Duncan.
</pre>
</blockquote>
<pre wrap=""><!---->
Duncan,
I have a service which marshals/unmarshals anys down to a persistent stream using dynanys recursively, in a portable way. It worked for several years until I tried to handle a nil objref, for interface Folder. From my debugger, the obj I get from to_object is a plain Object::_nil, while - when not nil - is fully qualified. That's might be ok since the typecode is a real Folder anyway. The point is that such service misses any static information to handle anys: it's fully dynamic, thus it cannot reconstruct the objref by invoking <a
class="moz-txt-link-freetext" href="Folder::_nil%28">Folder::_nil(</a>).
The normal way, e.g. object_to_string/string_to_object, ends up with a Object::_nil, not a <a
class="moz-txt-link-freetext" href="Folder::_nil">Folder::_nil</a>, inside the returned any.
What I missed was a way to reconstruct it, starting from a proper typecode and a (useless) nil contents.
Now I found a workaround, using create_dyn_any_from_type_code().
Thanks,
Renzo
</pre>
</div>
</body>
</html>