Boost logo

Boost :

From: Robert Ramey (ramey_at_[hidden])
Date: 2006-03-31 23:10:25


I'm not really sure what you want to do but I'll attempt to answer anyhow.

prez_at_[hidden] wrote:
> Hey,
>
> I want to use serialization for some kind of active replication,

It would seem to me that the easiest way to do this would be
to make a TEE type streambuf using the stream buffer library.
This would duplicate each write to an additional stream.

> however the biggest barrier to this is the fact that serialization
> does not allow me to put the same object into the stream twice. To
> be more precise, I want to be able to serialize both to a network and
> to disk, and I very much like the elegance of the serialization
> approach (plus the fact it can re-create pointer references, arrays,
> and such).

I believe the above would cover this.

> b) How difficult would it be to have more or less an 'appending'
> serialization stream - ie. I deserialize what I have previously stored
> on disk, and then continue to append to the serialization stream
> (which appends to the file from then on), making my serialization
> more or less unbounded.

I think something like that can be done now and is in fact already
being done. I know the somepeople are "embedding" serialization
data inside of other data by just passing the streambuffer around
without closing it.

> c) Is there currently an unbounded serialization stream? I mean,
> obviously the XML stream will not be 'complete' until you close the
> serialization stream and it can append any close tags it needs to,
> however if I wanted to continually write to a stream throughout the
> time my program is running, and if it crashes, be able to use that to
> get back to the state I was in, is it possible?

I believe that using "no_header" on opening might get you what you
want.

Robert Ramey


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