From: Jeff Garland (jeff_at_[hidden])
Date: 2004-04-20 22:00:35
On Wed, 21 Apr 2004 00:26:47 +0000 (UTC), Matthew Vogt wrote
> Robert Ramey <ramey <at> rrsd.com> writes:
> > Perhaps this is a source of confusion. It never occurred to me that the
> > other side wouldn't have the mirror serialization code. That is of you're
> > using xdr_oarchive to make the stream I assumed you would use xdr_iarchive
> > on the other side to recover the data. Even if you don't anticipate the
> > need for doing this yourself, other users will and they will want the
> > universal coverage that the current system provides.
> ... snip ...
> Now, as you rightly point out, CDR does provide for efficient binary
> representation of C++ primitive types. I can see that some people might
> prefer to use CDR as an on-wire format for communication between equivalent
> systems, so this certainly is a candidate for complete C++ coverage.
> This is complicated, however. If you were to allow full C++ serialization
> into a CDR archive, the result would be portable but not conformant
> to any standard or protocol, since it relied on the serialization
> library's object serialization method. Only another user of the
> serialization library could recover the serialized data.
Unless I'm mistaken you will have achieved a cross-platform (eg: big-endian,
little-endian compatible) efficient binary format for the case where you do
indeed have mirror serialization code on both sides. To me that's a huge win.
I can write to binary files or across a socket to any platform and as long as
I deserialize using the same code it should work. I don't believe the other
binary (maybe the text) archives can claim that. I think there is one more
restriction on the C++ code, however. Types would have to be coded with
'portable' types (eg: boost::uint_16, boost::uint_32, etc). But anyone doing
cross-platform development already does that, right ;-)
BTW, the CDR archive approach is a stark contrast to the idea of using highly
bloated XML where the overhead of the message far outstrips the actual data.
Perhaps I'm just one of those silly old fools that remembers when 'every byte
was precious', but it just seems crazy to me to use XML for network messaging. ..
> The use of CDR for true interoperability would involve the use of
> the CORBA IDL, and the CORBA object model. This is a long way away
> from simple marshalling...
I don't think we need to go there at all. I note that ACE has a similar class
to do this sort of marshelling.
Now obviously this is used in TAO (the CORBA implementation built on top of
ACE), but I've used it directly on a project to help serialize arbitrary C++
objects across a socket interface to heterogeneous platforms...
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk