Boost logo

Boost Users :

Subject: Re: [Boost-users] Using boost::serialization in real-time withoutallocating memory
From: Peter Soetens (peter.soetens_at_[hidden])
Date: 2009-09-18 08:30:34


On Thu, Sep 17, 2009 at 18:33, Robert Ramey <ramey_at_[hidden]> wrote:
> Peter Soetens wrote:
>
>> I might do what you suggest or look for another serialization
>> solution.
>
> Given the limited scope of what you want to do, it wouldn't be THAT hard to
> make your own archive.  Take a look at "trivial_archive" in the
> documentation and build from that.

Encouraged by your and Stefan's suggestions, I've spent another day at
looking what the possibilities are.

1. I first created my own binary_?archive classes which inherited from
common_?archive. This resulted in pulling in the library with the
'behind the scenes type tracking'. It seems, inheriting from common is
not an option for me if I want 'zero-allocation' serialization.
Correct ? (I also tested the demo_fast_archive.cpp extended with
no_header, but that one also allocated).

2. I then tried to work further on Stefan's code snippet. It works,
but indeed only for 'primitive_type's. I *think* I need functionality
upto the 'object_serializable' if I want std::vector<T> as well. Since
Stefan's operator& consumes every T, I'll need one operator& for each
primitive type, and then an operator& that tries to save/load using
free functions of the not primitive type.

3. It looks that I'll have to implement the Archive concept from
scratch or at least based on Stefan's code and the
load_binary/save_binary code from binary_?archive.

Am I on the right track ?

Peter


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