Boost logo

Boost Users :

Subject: Re: [Boost-users] [Serialization]Serializing from base classpointers clips derived class
From: Robert Ramey (ramey_at_[hidden])
Date: 2008-12-29 15:14:04


Looks like they are being called to me.

I think there is some confusion created by the fact that these pointers are tracked.

consider:

<rb2 class_id_reference="2" object_id_reference="_1"></rb2>

class_id_reference="2" which is the same as the class_id for rd2
object_id_reference="_1" indicates that this is the same object as rd2.

The information is not repeated because it has already been saved and
so its not necessary to repeat it and doing so might create duplicate
pointers on loading.

Robert Ramey

  "Daniel Roberts" <impulsionaudio_at_[hidden]> wrote in message news:14125aaf0812290842n908e83bsfcc338da63bac057_at_mail.gmail.com...
  Thanks for the response. Under closer inspection, the serialize calls are never made for either the derived classes or the base class when using a base class pointer. This is the xml output after save_derived is called:

  <?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
  <!DOCTYPE boost_serialization>
  <boost_serialization signature="serialization::archive" version="5">
  <rd1 class_id="0" tracking_level="1" version="0" object_id="_0">
      <polymorphic_base class_id="1" tracking_level="0" version="0"></polymorphic_base>
  </rd1>
  <rd2 class_id="2" tracking_level="1" version="0" object_id="_1">
      <polymorphic_base></polymorphic_base>
  </rd2>
  <rb1 class_id_reference="0" object_id_reference="_0"></rb1>
  <rb2 class_id_reference="2" object_id_reference="_1"></rb2>
  </boost_serialization>

  I am not sure where rb1 and rb2 tags come from since the serialize functions never get called. load_derived also does not call the serialize functions when using the base class pointers. I have attached the code I am using. It's identical to test_no_rtti.cpp except for two items. I do not have test_tools.hpp so I commented corresponding functions out and switched to std::ofstream/std::ifstream and xml_oarchive/xml_iarchive. Also, my target is a win32 console application. Please let me know if you have any ideas.
  Thanks,
  Daniel Roberts

------------------------------------------------------------------------------

  _______________________________________________
  Boost-users mailing list
  Boost-users_at_[hidden]
  http://lists.boost.org/mailman/listinfo.cgi/boost-users



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