Boost logo

Boost Users :

From: Aljaz (aljaz.fajmut_at_[hidden])
Date: 2007-02-15 12:17:20


Hello..
I use serialization to communicate betwen client and server..

Base and derived class for serialization (communication):

class base {
};
class derived : base {
};

What would be the 'good' way to export/import serialized data?
Can I do this with smart pointers?

Is this okay:

WRITING:
derived dc(4, 5, "some data");
std::ostringstream archive_stream;
boost::archive::text_oarchive archive(archive_stream);
archive & dc;
//send archive_stream.str() over network

RECIVING:
should I use base class pointer when deserializing?
or can I do it with base class reference?

For instance:
base *bc;
bc & in_data;

/////////
I'm little confused about reciving data.. I tried using base class reference
for deserializing derived class, but it doesnt work and it seems unlogical
to do it this way..
I would be really glad if someone could explain..

Thanks a lot


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