|
Boost Users : |
Subject: [Boost-users] Boost.Serialization type-dependent serialization
From: Roman Suvorov (windj007_at_[hidden])
Date: 2012-12-04 09:59:06
Hi!
I have a list of objects of the following structure:
> class Obj
> {
> // a number simple fields
> int field1() const;
>
> // ...
>
> // reference to an object containing large amount of data
> const blob_type & mega_blob() const;
> };
The list is to be serialized in the following way:
1) simple fields of each object are to be serialized into a single xml file;
2) mega_blobs' are to be serialized into separate binary files.
The idea of doing it is to write custom archive that has operator<<
specialized for blob_type which does the magic.
Following the Boost.Serialization reference
(http://www.boost.org/doc/libs/1_52_0/libs/serialization/doc/archive_reference.html),
I wrote the code in order to proof the concept:
http://pastebin.com/ekbXXvxF
My test project is built using CMake and G++-4.6.3 (Debian Wheezy)
(that seems to be ok - other code that uses Boost.Serialization
compiles well):
http://pastebin.com/WVRUKLD2
As a result I get the following linker errors:
http://pastebin.com/rM05nkqw
The questions:
1) am I using xml_oarchive_impl wrong way or that problem is not boost-related?
2) maybe there are more elegant ways of solving my task?
Cheers,
Suvorov Roman.
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