Boost logo

Boost Users :

Subject: Re: [Boost-users] [serialization - newbie] serializing/deserializing singleton class objects
From: Soumen (soumen78_at_[hidden])
Date: 2009-08-12 09:42:07


After I did some exception handling, it turned out that during serialization
some unregistered void cast was happening and that's causing stream error.
Probably debugger was pointing to wrong frame :(
After fixing those exception, crash is resolved. But I've new problem -
serialize doesn't write all data. And it seems the problem is because of
some ABC. Let me explain it here:

I've following class structure

A <--+-- B
       |
       +-- C

A is ABC and has no data member. B and C has data member. Some class D has
vector<A*> as data member. And my serialization code is something like
following:

D *dObj = D::instance();
oparchive << (const D&)(*dObj);

De-serialization code is something like following:

D::cleanup();
D *dObj = D::instance();
iparchive >> (*dObj);

I declare A as abstract through BOOST_IS_ABSTRACT. However, I also write an
empty serialize() for A.
Also, B and C serialization() uses base_object (*this). And B and C are
exported too.

Seems to me, the empty A::serialize() is causing the problem. But if I
remove it, the code doesn't compile unless I remove base_object (*this) from
B::serialize() and C::serialize().

I've verified that number of A objects in D after deserialization is same as
the number before serialization.
But those B or C objects (deserialised through A*) seems empty.

Regards,
~ Soumen

-- 
View this message in context: http://www.nabble.com/-serialization---newbie--serializing-deserializing-singleton-class-objects-tp24803268p24936765.html
Sent from the Boost - Users mailing list archive at Nabble.com.

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