|
Boost Users : |
Subject: [Boost-users] serialization: pointers to base classes
From: Hicham Mouline (hicham_at_[hidden])
Date: 2010-12-11 21:18:22
Hello,
I am unclear about registration and export.
I have this public single-derivation hierarchy
B
| \ \
D1 D2 D3
|
D11
The 5 structs are non abstract.
I will want to serialize (save) const B* and load it back with the
serialization lib constructing for me (on the heap) the right object.
Did I understand right that the library does this for me?
Does it construct the object on the heap?
I export the 5 structs with the macro BOOST_CLASS_EXPORT_GUID(ns::B, "B") at
global namespace level.
Do I have to register them too?
template <class Archive>
void serialize(Archive &ar, ns::B&, const unsigned int version)
{
ar.template register_type<D1>();
ar.template register_type<D2>();
ar.template register_type<D3>();
ar.template register_type<D11>();
}
or do I register for each class only the immediate derived?
regards,
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