
Júlio Hoffimann wrote:
Robert,
Could you please take a look at the following simplified scenario?
Suppose i have a base class B for which the serialization is just the dimension (2) and the associated probability distributions (uniform 0 1, uniform 0 1). A derived class D: B for which the serialization just adds the number of samples for each dimension (5, 5).
// // Somewhere in the code... // D obj; std::vector<boost::optional<double>> v;
while (in a loop) {
if (is time to save) {
boost::fylesystem::remove( archive_filename ); boost::ofstream file( archive_filename ); boost::archive::text_oarchive oa( file ); oa << obj << v; } }
The archive contents for this case:
22 serialization::archive 9 0 7 UQ::PCM 1 0 0 0 0 2 0 0 2 0 0 0 7 uniform 2 0 0 1 7 uniform 2 0 0 1 2 0 5 5 0 0 25 0 0 0 1 0 0.002200555327023207 1 0 0.010825220107479879 1 0 0.023455038515334009 1 0 0.036084856923188136 1 0 0.044709521703644811 1 0 0.010825220107479879 1 0 0.053252644428581027 1 0 0.11538267247357922 1 0 0.1775127005185774 1 0 0.21994012483967856 1 0 0.023455038515334009 1 0 0.11538267247357922 1 0 0.25 1 0 0.38461732752642075 1 0 0.47654496148466596 1 0 0.036084856923188136 1 0 0.1775127005185774 1 0 0.38461732752642075 1 0 0.59172195453426402 1 0 0.73314979812965331 1 0 0.044709521703644811 1 0 0.21994012483967856 1 0 0.47654496148466596 1 0 0.73314979812965331 1 0 0.90838040126568709
Could you very generally explain what each section is about? I'm trying hard to fix the bug in my code, but all the approaches i had so far were not successful. :-(
have you tried using an xml_?archive ? This will reveal all the names and types serialized. It's very easy to read. It it will give exactly the answer to the questiion you're asking. Robert Ramey