Discussion:
[omniORB] Recursive sequences
Robert Gartler
2012-02-22 20:46:51 UTC
Permalink
Hi!

I have a problem with omniORB 4.1.6 and omniORBpy 3.6.

I used to use anonymous sequences to build recursions:

struct ReservationTreeNode {
string zoneName;
sequence<ReservationTreeNode> children;
};

But when I used omniidl to build the python bindings, omniidl complained:
Warning: Anonymous sequences for recursive structures are deprecated.
Use a forward declaration instead.

So I did what I was told and changed my IDL to use named sequences:

struct ReservationTreeNode;
typedef sequence<ReservationTreeNode> ReservationTreeNodeList;
struct ReservationTreeNode {
string zoneName;
ReservationTreeNodeList children;
};

Now omniidl is happy, but the following python line doesn't work anymore
once the content_type is a ReservationTreeNodeList:

tc.content_type().kind()

....
File "/home/gartler/knapp/lager/bin/gcs_lib.py", line 78, in
printSequence
print_map[tc.content_type().kind()](
File "/usr/local/lib/python2.7/site-packages/omniORB/tcInternal.py",
line 716, in content_type
return createTypeCode(self._d[1], self)
File "/usr/local/lib/python2.7/site-packages/omniORB/tcInternal.py",
line 431, in createTypeCode
return createTypeCode(d[1][0], parent)
File "/usr/local/lib/python2.7/site-packages/omniORB/tcInternal.py",
line 365, in createTypeCode
raise CORBA.INTERNAL()
CORBA.INTERNAL(0x0, CORBA.COMPLETED_NO)
Exception: CORBA.INTERNAL(0x0, CORBA.COMPLETED_NO)

Does anybody have an idea on how to solve this?

Cheers,
Robert
--
Ing. Robert Gartler, BSc
Head of SRC and Guardian Development
-------------------------------------------------------
KNAPP AG
G?nter-Knapp-Strasse 5-7
A-8075 Hart bei Graz, Austria
Robert Gartler
2012-02-22 21:21:35 UTC
Permalink
Missing information:

tc is the typecode:

obj = ctx.resolve([binding.binding_name])

try:
tc = obj.typecode()
--
Ing. Robert Gartler, BSc
Head of SRC and Guardian Development
-------------------------------------------------------
KNAPP AG
G?nter-Knapp-Strasse 5-7
A-8075 Hart bei Graz, Austria
Duncan Grisby
2012-02-27 21:47:52 UTC
Permalink
Post by Robert Gartler
Warning: Anonymous sequences for recursive structures are deprecated.
Use a forward declaration instead.
It's only a warning, so you can choose to keep the old IDL if you
want...

[...]
Post by Robert Gartler
struct ReservationTreeNode;
typedef sequence<ReservationTreeNode> ReservationTreeNodeList;
struct ReservationTreeNode {
string zoneName;
ReservationTreeNodeList children;
};
Now omniidl is happy, but the following python line doesn't work anymore
tc.content_type().kind()
There's a problem where some code that handles release of recursive
sequences was a bit too aggressive at releasing things. It works to
access the content_type the first time, but after that it breaks. The
attached patch should fix it. Does it?

Cheers,

Duncan.
--
-- Duncan Grisby --
-- ***@grisby.org --
-- http://www.grisby.org --

-------------- next part --------------
A non-text attachment was scrubbed...
Name: typecode.patch
Type: text/x-patch
Size: 2390 bytes
Desc: not available
Url : http://www.omniorb-support.com/pipermail/omniorb-list/attachments/20120227/93dd8d92/typecode.bin
Robert Gartler
2012-03-01 13:23:42 UTC
Permalink
Post by Robert Gartler
struct ReservationTreeNode;
typedef sequence<ReservationTreeNode> ReservationTreeNodeList;
struct ReservationTreeNode {
string zoneName;
ReservationTreeNodeList children;
};
Now omniidl is happy, but the following python line doesn't work anymore
tc.content_type().kind()
There's a problem where some code that handles release of recursive
sequences was a bit too aggressive at releasing things. It works to
access the content_type the first time, but after that it breaks. The
attached patch should fix it. Does it?
It does.
Is there any drawback? Or will this patch be included in the next
omniORBpy release?

Loading...