Boost logo

Boost :

Subject: Re: [boost] [Serialization] Future of Boost.Serialization
From: Brian Poole (brpoole_at_[hidden])
Date: 2011-02-14 19:56:08


On 02/14/11 14:17, Daniel Larimer wrote:
> It seems to me that Boost.Serialization is only compatible with itself and
> even though it can 'read/write' to/from a XML or even a 'json' file, it
> gives you very little control over the resultant structure of the file,
> because it throws in version info, object graphs, etc. So attempting to
> implement a JSON RPC built on Boost.Serialization is difficult if you do not
> control both sides of the RPC.
>
> Another example would be implementing a binary RPC protocol that must
> communicate with an embedded device that only supports C. It would be very
> difficult to craft specific byte streams from structs without knowing the
> internals of Boost.Serialization. It appears that the only option at the
> moment is to implement your own Archive.
>
> Dan
>

I've used Boost.Serialization to implement several network interfaces
where I had no control over the protocol format and had to craft an
Archive class to adhere to the given standard. In my experience, this
approach has been much cleaner and simpler than trying to write the
marshaling code in each object. It's paid dividends when I have needed
to save an object and can use the default text or xml Archives. The
Serialization library has a macro |BOOST_CLASS_IMPLEMENTATION(my_class,
boost::serialization::||object_serializable||) that will serialize the
class using the serialize() function but add no extra class or version
information. In this case, you know exactly what the serialized byte
stream will look like at the expense of having to write a simple Archive
class

Brian|


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk