Boost logo

Boost Users :

From: Baranowski, Daniel (dbaranowski_at_[hidden])
Date: 2006-10-12 09:44:18


> From: "Robert Ramey"
> Subject: Re: [Boost-users] [Serialization] Serializing to a void * and
> a size?
..snip..
> Look inthe documenation Reference/Serializable Concept/Serialzation
> Wrappers/ Binary Objects
..snip..
> > // Create an object on the heap
> > A * pA = new A;
> > pA->x = 1234567890;
> >
> > // serialize it
> > std::ostringstream sTestBinary1;
> > boost::archive::binary_oarchive oa(sTestBinary1);
> oa << binary_object(sizeof(A), pA);
..snip..

Thanks for replying Robert!

I'm not quite sure that's what I was after though. I'm concerned with
when I make class A more complicated and it holds data that is beyond
the sizeof(A), such as a pointer to data new'ed on the heap. Since I'm
new with the serialization library, bear with me, if I completely missed
what binary_object does.

What I am trying to do is basically get all the data that would be
written to the file when using a binary_oarchive (or text_oarchive if
that would be better). Then take that data, and pass it off as a void *
to that data that was serialized and the sizeof that data. I think what
you showed me, while usefully, is a quick way of serializing a simple
struct/class.

The more I think about this, the more I wonder if this is a boost
question or a stream question. Never-the-less, if you have any advice, I
would be very thankful.

Regards,
Daniel
**********************************************************************************************
Disclaimer - This email and any files transmitted with it are proprietary and may contain privileged or copyright information. You must not present this message to another party without
gaining permission from the sender. If you are not the intended recipient you must not copy, distribute or use this email or the information contained in it for any purpose other than to notify
us. If you have received this message in error, please notify the sender immediately, and delete this email from your system. We do not guarantee that this material is free from viruses or any
other defects although due care has been taken to minimize the risk. eSafe scanned this email for viruses, vandals and malicious contentAny views expressed in this message are those of
the individual sender, except where the sender specifically states them to be the views of LSI.
**********************************************************************************************


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net