Boost logo

Boost Users :

Subject: [Boost-users] [serialization] Special case of abstract Interface serialization.
From: Germán Diago (germandiago_at_[hidden])
Date: 2009-10-23 06:39:43


Hello. I have a problem which I think it's not documented, and I don't
know how to solve it.

The problem is the following:

I have a framework with an Object base class.

I have an interface IDrawable. Interfaces don't inherit Object.

Now I have a container, which holds IDrawables.

class IDrawable { virtual void draw() const = 0; }

Container<IDrawable *> drawables; //holds IDrawables that I know they
are Objects.

I do know that inside the drawables, objects are held, so now I want
to serialize that container:

ar << drawables;

IDrawable does not hold any data, but Object does. So I want to
serialize these objects
in a polymorphic way, so that I can save anything derived from Object
which is pointed
by an IDrawable.

Thanks for your time.


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