Boost logo

Boost :

From: Ian McCulloch (ianmcc_at_[hidden])
Date: 2005-10-16 11:48:32


Robert Ramey wrote:

> Matthias Troyer wrote:
>
>> For a portable binary archive this solution is perfect. For fast
>> array serialization a similar approach has problems, as I outlined
>> under point 3 and 4 in my response to Robert Ramey: you need to
>> specifically overload _in the archive_ for all classes that want to
>> make use of fast array serialization, thus introducing a tight
>> coupling between archive and class to be serialized, as well as
>> making it hard to extend.
>
> Here is where were on different pages. you only have to override
> serialization of vector etc in only one place - in the
> fast_archive_adaptor class.
> Then the behavior is available to any class that the adaptor is applied
> to.

IIUC (apologies if I am missing something), Matthias' argument is that

1. serialization of std::vector needs to be overridden in the
fast_archive_adaptor class.

2. serialization of builtin arrays needs to be overridden in the
fast_archive_adaptor class.

3. serialization of ublas::vector needs to be overridden in the
fast_archive_adaptor class.

4. serialization of ublas::matrix needs to be overridden in the
fast_archive_adaptor class.

5. serialization of mtl::vector needs to be overridden in the
fast_archive_adaptor class.

6. serialization of mtl::matrix needs to be overridden in the
fast_archive_adaptor class.

7. serialization of blitz::array needs to be overridden in the
fast_archive_adaptor class.

8. serialization of custom_lib::fast_matrix needs to be overridden in the
fast_archive_adaptor class. Unfortunately this is not so easy as
custom_lib::fast_matrix is maintained by someone else and the serialization
functions need access to some classes buried deep in some private
implementation header.

9 .....

So, N functions, most of which are trivial forwards to a save_array /
load_array function.

Cheers,
Ian


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk