Boost logo

Boost Users :

Subject: [Boost-users] [serialization] "unregistered class" with 1.41, o.k. with 1.38
From: Ruediger Berlich (ruediger.berlich_at_[hidden])
Date: 2009-12-21 09:24:24


Hi there,

Consider a hierarchy of classes that is accessed through an abstract base
class. The most derived class is a template which is "filled" with the basic
types bool, char, boost::int32_t and double.

I use typedefs of the kind "typedef GParameterT<char> GChar;" for ease of
use.

This is held in its own header file, in this case GChar.hpp . A
corresponding GChar.cpp holds the export statement needed to register the
class (or typedef in this case):

#include <boost/serialization/export.hpp>
BOOST_CLASS_EXPORT(Gem::GenEvA::GChar)

There are also identical (except for base types) files for GDouble, GBoolean
and GInt32 (holding the tell-tale typedefs and exports for the corresponding
types).

I'm using unit tests for my library, and there you will find code like:

// Test (de-)serialization in different modes
{ // plain text format
  T gpt4(gpt0);
  BOOST_CHECK(gpt4.isEqualTo(gpt0));
  BOOST_CHECK_NO_THROW(gpt4.fromString(gpt1.toString(TEXTSERIALIZATION),
                                                     TEXTSERIALIZATION));
  BOOST_CHECK(!gpt4.isEqualTo(gpt0));
  BOOST_CHECK(gpt4.isSimilarTo(gpt1, exp(-10)));
}
// [ ... further serialization modes removed ... ]

T can again be GChar, GBoolean, GDouble or GInt32 . to/fromString is a
simple wrapper to the serialization calls (all happening through the base
pointer).

Now I have the problem that the toString/fromString throws an "unregistered
class" with Boost 1.4.1, but **only** if GParameterT is fed a double or a
boost::int32_t . (De-)Serialization works fine with char and bool as
template parameter.

With Boost 1.38, no errors occur at all, and also my production code works
nicely with 1.41 (and it uses Boost.Serialization extensively).

Any idea ?

In any case: Thanks for a great library and have a nice christmas time and a
happy new year!

Best Regards,
Ruediger


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