[omniORB] CORBA::Any serialization

David Riddoch djr@uk.research.att.com
Thu, 6 May 1999 08:15:49 +0100 (GMT)


Hi,


You're right, there is no portable way, and yes your approach is the right
one for omniORB. After you have inserted the Any into the
MemBufferedStream you can find out how many bytes you have written using
the alreadyWritten() method.

Also see:
  http://www.uk.research.att.com/omniORB/archives/1999-04/0104.html

for a solution to a similar problem (writing an Any to a file).


Hope that helps,
David


On Thu, 6 May 1999, J. Cameijo Cerdeira wrote:

> Hi,
> 
> I'm writing a server which needs to serialize an Any data type in order 
> to write/read it to/from a blob field on a database. I cannot find a
> suitable way to do this using the CORBA C++ mapping (although i think
> the java one allows an any to be used with an output or input stream)
> 
> An octet string since cannot be used since that Any value must be
> exchanged with the clients who expect structured data. It's clear that
> if serialization is shifted to the client side, it poses the same
> problem.
> 
> I believe there's no portable way to do this. Anyway, using omniORB i
> devised the following procedure for serialization (deserialization would
> be done the other way around):
> 
> -write the any to a MemBufferedStream
> -issue get_char_array to read a character array with the serialized
> data.
> 
> The problem is I cannot tell which is the size of the data stored in 
> MemBufferedStream since itssize() method is private. Why is this ?
> What's the possible workarounds ? Am I missing something ?
> 
> MTIA
> 
> J. Cameijo Cerdeira
> 
>