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. :-(

Even the v.size() being constant during the entire run (just the boost::optionals<> change), seems the archive overwrite operation above is putting different amount of words in the file as the simulation goes on. Maybe is something related to object tracking? How is v tracked?

I really appreciate any help,
Júlio.

2012/3/25 Júlio Hoffimann <julio.hoffimann@gmail.com>
Thank you for your reply Robert, i'll take a better look at what is happening. I rewrote my application to use text_archives for debug purposes, and just now realized there is no defined format.

If i find something that can help solve the problem, i'll share. ;-)

Regards,
Júlio.


2012/3/25 Robert Ramey <ramey@rrsd.com>
Júlio Hoffimann wrote:
> Dear all,
>
>
> I'm trying to debug an application and would be helpful to know how
> the contents of the archives should look like. I read the entire
> Boost.S11n documentation, but can't find any explanation about the
> archive file formats.

This is because the file formats are undefined.  More accurately, the file
format is defined by (and reflects) the structure of the achive data.  This
easy to see my using the serialization library on your own classes and
and generating an XML archive.  This is nicely indented and you'll
be able to see the one-to-one correspondence from your C++ classes
to the archive text.

That is, C++ data structures => archive format.

Note that is the opposite from other approaches such as google
protocol buffers which do something like:

protocol buffers description => C++ code to read/write the file.

If one thinks about it, you can see that these are not really comparable
as they really do different things.

>
> Do you have some technical material?
>
>
> I'm having an annoying (and famous) "input stream error":
> http://stackoverflow.com/questions/5178321/boost-serialization-problem-in-windows-vs2005-input-stream-error.
> The link describes exactly the same problem, the "author's solution"
> isn't satisfactory at all.

This doesn't ring a bell with me.  Check the Trac system to see if it's
already described in there.  If it's not, feel free to include you're own
description of the problem and optionally suggestions and/or you're own
patch. I'll be happy to look at it.

Robert Ramey

>
>
> Best regards,
> Júlio.
>
>
>
> _______________________________________________
> Boost-users mailing list
> Boost-users@lists.boost.org
> http://lists.boost.org/mailman/listinfo.cgi/boost-users




_______________________________________________
Boost-users mailing list
Boost-users@lists.boost.org
http://lists.boost.org/mailman/listinfo.cgi/boost-users