Subject: [boost] [Serialization] Is there a way to "stop" a polymorphic serialization at a given class level
From: nico (nicolas.guillot_at_[hidden])
Date: 2012-04-16 09:46:46
I admit the subject is not really understandable, but you'll see it's not
so obvious to summarize the question...
I use the boost serialization system and its polymorphic base serialization
For that, and for serialization code instantiation, I use the registration
macros BOOST_CLASS_EXPORT_KEY and BOOST_CLASS_EXPORT_IMPLEMENT.
If I have a concrete class A in a inheritance tree like that :
C is base of B is base of A ( C <|---B <|---A )
C is not instanciable (it has pure virtual functions)
B is instanciable
Is there a way to "stop" the serialization of a A object to B level?
If I have this code:
C* obj = new A();
// declare boost archive ar to serialize obj
ar & obj;
Is there a way to tell to boost serialization to serialize only until B.
This obj serialized is deserialized in another application, where only C
and B are known and used.
A only defines technical stuff, but nothing with data (and serialization),
so it will never be used as A*.
I try with something like that :
void A::serialize(Archive & ar, const unsigned int version)
B* b = new B(static_cast<B*>(this));
ar & b;
but is there a more "boost-serialization-system" way ? (I expect no...)
What do you recommend ?
Thanks for help.
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk