Boost logo

Boost Users :

Subject: Re: [Boost-users] [serialization] polymorphicportablebinaryexamplenot working.
From: Robert Ramey (ramey_at_[hidden])
Date: 2010-03-15 18:42:08


Mostafa wrote:
>>> Because there's no polymorphic_text_oarchive.cpp
>>> counterpart,
>>
>> I think this is in the src directory. It should be pre-compiled
>> into the library so you never actually see it. The portable binary
>> archive is an example, so it's not included in the library.
>>
>
> There is no polymorphic_text_oarchive.cpp or
> polymorphic_text_iarchive.cpp in the boost 1.42 source. A search in
> the source for "polymorphic*archive.cpp" only reveals:
>
>
> ./libs/serialization/example/polymorphic_portable_binary_iarchive.cpp
> ./libs/serialization/example/polymorphic_portable_binary_oarchive.cpp
> ./libs/serialization/src/polymorphic_iarchive.cpp
> ./libs/serialization/src/polymorphic_oarchive.cpp
>
> And the latter 2 files basically only have these explicitly
> instantiations:
> template class archive_serializer_map<polymorphic_iarchive>;
> template class archive_serializer_map<polymorphic_oarchive>;
>
> Which I don't believe should be replicated in
> polymorphic_portable_binary_iarchive.cpp or
> polymorphic_portable_binary_oarchive.cpp since in the boost source
> code there is no explicit instantiations of the following forms:
>
> template archive_serializer_map<polymorphic_text_iarchive>
> template archive_serializer_map<polymorphic_text_oarchive>
> ...
> etc.
>
>
> BTW, why are you using explicit instantiations with seperate template
> .cpp files? It becomes a management nightmare keeping track of what
> needs to be explicitly instantiated in large projects. They're
> templates, so why not just have everything in headers? An additional
> advantage being that code is only generated for code that's used
> (implicitly instantiated) by the client.

OK - you've got me.

* The portable_binary_?archive was originally created
as an example many years ago to illustrate how one could derive from
an existing archive to create a new one.

* This got broken - un beknownst to me - when changes were added
to the binary_archive to support fast serialization of certain collections.

* Then I got a small consulting contract to make a fix in it. Only
then did I discover that it had been broken.

* So I rewrote it from scratch to fullfill the obligations of the contract.
As part of this, I made it work as a polymorphic archive.

* Then the binary_?archive got changed again so that the version
based derivation would work - not that it mattered by this time.

To summarize - I don't remember where which code is is
which module. So looks like you're the expert now. I believe
that polymorphic...archive is only the thinnest of wrappers.
The simple truth is that I don't remember - I would have to
go look it up. You're already ahead of me on that.

Robert Ramey


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