Boost logo

Boost Users :

From: Jeff Flinn (TriumphSprint2000_at_[hidden])
Date: 2008-03-11 09:24:03


Jerry wrote:
> Hi,
>
> boost::serialization is wonderful. It has saved a massive amount of
> effort when adding XML based storage to an existing C++ drawing
> library. A very big thank you to the author and the team.
>
> Questions arising:
>
> 1. After one or two crash & burn cycles i discovered the need to
> register derived classes in the 'save through a virtual base class
> pointer' scenario. Right now this is done when saving to/loading from
> the archive. Is there an alternative to this method that ensures
> registration occurs automatically? i'm sure this is a FAQ but cannot
> find a definitive answer.
>
> i..e
>
> // XML archive
> boost::archive::xml_iarchive ia(ifs);
> // ensure derived types are registered - too easy to forget, what's the
> better way?
> ia.register_type(static_cast<CDiagramButton*>(NULL));

Look for the BOOST_...EXPORT macros, but they're still not automatic.

> 2. Serializing to a binary storage should be a great way to implement
> undo/redo and clipboard functionality - has anyone found fame and
> fortune doing this?

Yes, use the boost::iostream library to create a stream that wraps your
clipboard or other binary storage.

Jeff Flinn


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