Boost logo

Boost Users :

Subject: Re: [Boost-users] Serialization of a complex data structure
From: Marco Meoni - Sbaush (sbaush_at_[hidden])
Date: 2010-04-29 11:53:58


i read all the boost manual, but i don't have found how serialize nested
structures editing only the first struct.

i can't put the serialize method in the Container because Container contains
a lot of other structures, and these structures contain other structures and
so on.

I wish I could serialize all serializing only the parent class

Can you help me, pointing the manual section with this, or show me a basic
example?
Thank you so much.

On Thu, Apr 29, 2010 at 6:29 PM, Robert Ramey <ramey_at_[hidden]> wrote:

> Marco Meoni - Sbaush wrote:
> > I obtain this error:
> > c:\boost\boost_1_42\boost\serialization\access.hpp(118) : error
> > C2039: 'serialize' : is not a member of 'Container'
> >
> >
> > I can overcome the problem by defining the serialize method inside
> > container. But container is an external library, so i can't modify
> > it. I would serialize the entire contents of Example without touching
> > the others structures. I thought that smart pointers could be the
> > right solution for me. What i shoud do instead in your opinion?
> >
> >
> > thanks.
> >
> >
> > Marco.
> >
> >
> > On Wed, Apr 28, 2010 at 11:19 PM, Robert Ramey <ramey_at_[hidden]> wrote:
> >
> > Marco Meoni - Sbaush wrote:
> >> struct Example{
> >> friend class boost::serialization::access;
> >> template<class Archive>
> >> void serialize(Archive & ar, const unsigned int /*
> >> file_version */){
> > ar & results_container; // INCLUDE THIS
> >
> >> }
> >> Container* results_container;
> >> MyMap this_is_a_map;
> >> Example(){}
> >> ...
> >> ...
> >> };
> >
> > Try specifying which members you want to serialize in the serialize
> > function. See above.
> >
> Make sure your serialize function is in the proper namespace - see manual.
>
> Robert Ramey
>
>
> _______________________________________________
> Boost-users mailing list
> Boost-users_at_[hidden]
> http://lists.boost.org/mailman/listinfo.cgi/boost-users
>

-- 
Marco Meoni - Sbaush
www.marcomeoni.net


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