[omniORB] python access to streams

Sai-Lai Lo S.Lo@uk.research.att.com
16 Feb 2000 15:53:06 +0000


In C++ land, here is some information on how to serialise arbitrary
arguments into a CDR stream (I think this is a more appropriate term than
GIOP stream):

http://www.uk.research.att.com/omniORB/archives/1999-01/0103.html

Notice that the class MemBufferedStream mentioned is an omniORB specific
class. This will work with omniORB 2.x and omniORB 3

In a future release when the new GIOP engine is merged, the
MemBufferedStream will be gone but will be replaced with a similar class
that can do the same thing. Your code just have to modify to make use of
the new API.

Sai-Lai


>>>>> Ted Horst writes:

> On Wed, 16 Feb 2000, Duncan Grisby wrote:
>> On Tuesday 15 February, Ted Horst wrote:
>> 
>> > Is it possible to get access to GIOP encapsulations from python ?
>> >
>> > In Fnorb, to archive a struct to a stream, I would do something like:
>> >
>> > foo = MyIDLStructClass(....)
>> > stream = CORBA.OctetStream.Encapsulation()
>> > cursor = stream.cursor()
>> > tc = CORBA.typecode(foo._FNORB_ID)
>> > tc._fnorb_marshal_value(cursor, foo)
>> > encap_string = cursor.stream().data()
>> 
>> Is there any particular reason that you want these to be GIOP
>> encapsulations?  Do you want to read them from another language?  I
>> suppose there is some scope for using GIOP's CDR as a cross-language
>> pickling format. Unless you want cross-platform capabilities, I would
>> suggest that it is far better to use Python's normal pickle or marshal
>> modules.

> Yes, I am trying to use GIOP's CDR as a cross-language pickling format.  We  
> are using CORBA to communicate between python, Objective-C, C++, and Java  
> on a couple of different platforms, and we have some generic data structures  
> defined in IDL that we pass around.  It thought it would be nice to  
> leverage the CDR encoding of these structures to persist some of this data.

>> 
>> It wouldn't be too hard to add GIOP stream access to omniORBpy, but it
>> would require additions to the C++ code. As omniORBpy stands, Python
>> never gets its hands on the marshalled GIOP stream.

> Ok, I will take a shot at this and post to the list.


-- 
Sai-Lai Lo                                   S.Lo@uk.research.att.com
AT&T Laboratories Cambridge           WWW:   http://www.uk.research.att.com 
24a Trumpington Street                Tel:   +44 1223 343000
Cambridge CB2 1QA                     Fax:   +44 1223 313542
ENGLAND