Boost logo

Boost Users :

From: Marc Wäckerlin (marc_at_[hidden])
Date: 2007-01-29 04:19:01


Hi

I have the following problem:

My class structure is somehow like that:

class A; // is pure virtual
template <int NUM, typename ENUM> class B: public A;
[...]

I use my BinaryWrite archive class, as specified in thread:

"[boost::serialization] Binary Stream with noAdditional Info: Here's the
solution! [Howto derieve ownserialization archive?]"

Now, when I try to stream a
std::vector < boost::shared_ptr < A > >
then I see in the function-trace log, that my writer has been called for the
parent type A, but not for the derived types (B, C, ...).

After this, I read again the "Except for one special case" part in the
Archive Class Reference manual. After this, I added the following code in
front of my archive type:

====================================================================
namespace image {
  class BinaryWriter;
  class BinaryReader;
}
#define BOOST_ARCHIVE_CUSTOM_OARCHIVE_TYPES ::image::BinaryWriter
#define BOOST_ARCHIVE_CUSTOM_IARCHIVE_TYPES ::image::BinaryReader

#include <boost/archive/detail/iserializer.hpp>
#include <boost/archive/detail/oserializer.hpp>
#include <boost/archive/detail/common_iarchive.hpp>
#include <boost/archive/detail/common_oarchive.hpp>

#include <boost/serialization/export.hpp>
====================================================================

But it still does not step into the correct child. After some more reading,
I guess, that I'd have to use BOOST_CLASS_EXPORT(B), but that does not
compile, because B is a template class.

What's wrong, what's missing, what do I have to do?

Thank you
Regards
Marc


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