[Wave][Serialization] Problems with class versioning

Hi all, I was trying to add class versioning to the serialization code for the Wave library (for storing macro tables et.al.) but couldn't succeed. I've added a class version to the code by adding: namespace boost { namespace serialization { template< typename Iterator, typename LexIterator, typename InputPolicy, typename Hooks
struct version<boost::wave::context<Iterator, LexIterator, InputPolicy, Hooks> > { typedef boost::wave::context<Iterator, LexIterator, InputPolicy, Hooks> target_type; typedef mpl::int_<target_type::version> type; // version == 0x100 typedef mpl::integral_c_tag tag; BOOST_STATIC_CONSTANT(unsigned int, value = version::type::value); }; }} // namespace boost::serialization The save function of the context<> now get's called during serialization with the correct version value. But during load the context<>::load function still get's passed zero as the loaded version. Is this a known behaviour, am I ding something wrong (perhaps essential: context is explicitely marked as 'track_never')? Regards Hartmut

My best guess is that you're using a binary archive and the maximum version number stored/recovered in a binary archive is 1 byte - 255. Another guess might be that if the type is part of a collection, it might have tripped on a recently reported bug that that lost the version number of the items in a collection. I don't know if that's your case or which version you are using. Robert Ramey Hartmut Kaiser wrote:
Hi all,
I was trying to add class versioning to the serialization code for the Wave library (for storing macro tables et.al.) but couldn't succeed. I've added a class version to the code by adding:
namespace boost { namespace serialization {
template< typename Iterator, typename LexIterator, typename InputPolicy, typename Hooks
struct version<boost::wave::context<Iterator, LexIterator, InputPolicy, Hooks> > { typedef boost::wave::context<Iterator, LexIterator, InputPolicy, Hooks> target_type; typedef mpl::int_<target_type::version> type; // version == 0x100 typedef mpl::integral_c_tag tag; BOOST_STATIC_CONSTANT(unsigned int, value = version::type::value); };
}} // namespace boost::serialization
The save function of the context<> now get's called during serialization with the correct version value. But during load the context<>::load function still get's passed zero as the loaded version. Is this a known behaviour, am I ding something wrong (perhaps essential: context is explicitely marked as 'track_never')?
Regards Hartmut
_______________________________________________ Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost

Robert Ramey wrote:
My best guess is that you're using a binary archive and the maximum version number stored/recovered in a binary archive is 1 byte - 255.
That's it! Thanks a lot. Regards Hartmut
Another guess might be that if the type is part of a collection, it might have tripped on a recently reported bug that that lost the version number of the items in a collection. I don't know if that's your case or which version you are using.
Robert Ramey
Hartmut Kaiser wrote:
Hi all,
I was trying to add class versioning to the serialization code for the Wave library (for storing macro tables et.al.) but couldn't succeed. I've added a class version to the code by adding:
namespace boost { namespace serialization {
template< typename Iterator, typename LexIterator, typename InputPolicy, typename Hooks
struct version<boost::wave::context<Iterator, LexIterator, InputPolicy, Hooks> > { typedef boost::wave::context<Iterator, LexIterator, InputPolicy, Hooks> target_type; typedef mpl::int_<target_type::version> type; // version == 0x100 typedef mpl::integral_c_tag tag; BOOST_STATIC_CONSTANT(unsigned int, value = version::type::value); };
}} // namespace boost::serialization
The save function of the context<> now get's called during serialization with the correct version value. But during load the context<>::load function still get's passed zero as the loaded version. Is this a known behaviour, am I ding something wrong (perhaps essential: context is explicitely marked as 'track_never')?
Regards Hartmut
_______________________________________________ Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost
_______________________________________________ Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost
participants (2)
-
Hartmut Kaiser
-
Robert Ramey