|
Boost Users : |
Subject: Re: [Boost-users] [serialization] deserialized instance empty even though proper serialize methods called [Honeywell Internal]
From: Hickman, Steve (AdvTech) (Steve.Hickman_at_[hidden])
Date: 2014-06-03 06:34:24
Classification: Honeywell Internal
All serialize methods (except the base class serialize method) have as their first three lines code like this (with the appropriate
BOOST_LOG_TRIVIAL(trace) << CLASS_METHOD << " called";
boost::serialization::void_cast_register<derived, base>(
static_cast<derived *>(nullptr),
static_cast<base *>(nullptr)
);
ar & BOOST_SERIALIZATION_BASE_OBJECT_NVP(base);
If that's what you're referring to, it didn't fix the problem
--- Steve H. ============================================================================================================================================================================================================ This message classified as Honeywell Internal by Hickman, Steve (AdvTech) on Tuesday, June 03, 2014 at 3:34:21 AM. The above classification labels are in accordance with the Honeywell Corporate Classification Policy. The information contained in this electronic message is confidential and intended only for the use of the individual/entity named above, and the information may be privileged. If you, the reader of this message, are not the intended recipient or an employee or agent responsible to deliver this message to the intended recipient, you are hereby notified that any dissemination, distribution or copying of this communication is strictly prohibited. If you have received this communication in error, please immediately notify the sender and delete the original message. ============================================================================================================================================================================================================ From: Robert Ramey [mailto:robertmacleranramey_at_[hidden]] Sent: Sunday, June 01, 2014 11:22 AM To: boostusers_at_[hidden] Cc: robertmacleranramey_at_[hidden]; boost-users_at_[hidden]; Hickman, Steve (AdvTech) Subject: Re: [Boost-users] [serialization] deserialized instance empty even though proper serialize methods called On Saturday, May 31, 2014 2:50:35 PM UTC-7, Robert Ramey wrote: I woke up in the middle of the night. The "registration" base/derived pair is a side effect of class Base { virtual~Base(); template<class Archive); void serialize(Archive ar, const unsigned int version); }; class Derived { virtual~Derived(); template<class Archive); void serialize(Archive ar, const unsigned int version); }; template<class Archive); void Derived::serialize(Archive ar, const unsigned int version){ ar & boost::serialization::base_object<Base &>( *this); // side effect void_cast_register(Base, Derived) which updates the table when DLL is loaded } So I'm guessing that you're not calling the base class serialization so the Base/Derived pair isn't being registered. Solution: explicitly declare, define and call the Base class serialization even though it is empty. or explicitly invoke register void_cast::register base/derived - i forget the exact name. I'll be surprised if that doesn't solve your problem. RObert Ramey
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