Boost logo

Boost Users :

Subject: Re: [Boost-users] Pointer serialization and deserialization
From: Robert Ramey (ramey_at_[hidden])
Date: 2009-03-10 03:35:26


Sorry, I can't see anything wrong with it.

Robert Ramey
  "niranjan bangera" <niranjannina_at_[hidden]> wrote in message news:50a2f6f20903092259x5a6bfc6dg86cae801083ec8fc_at_mail.gmail.com...
  Robert,

  Yes the pointer is been initialized by NULL in the constructor of the class of that pointer.

  Thanks,
  Niranjan

  Do you know for a fact that the pointer has been initialized?

  Robert Ramey
    "niranjan bangera" <niranjannina_at_...> wrote in message news:50a2f6f20903090457n37c0bfb2n3eec9d716a56c84c_at_......
    Hi all,

    Boost:1.38.0
    compiler:gcc4.1.1

    I am trying to serialize and deserialize a pointer to the class, but ended with the segmentation fault, Is that the null pointer serialization gives the segmentation fault?. I read in document that, library will maintain the Null pointer. if not how can i serialize? ,any docs or related refference is a;so acceptable. Thanks in advance....

    one more thing: what -1 in archive(text_archive) indicates?

    Example
    ------------

    #include <fstream>
       #include "boost/archive/text_iarchive.hpp"
       #include "boost/archive/text_oarchive.hpp"
      #include "boost/serialization/access.hpp"
      #include "boost/serialization/assume_abstract.hpp"

    class Dkpt
    {

    public:

      friend class boost::serialization::access;
        template<class Archive>
        void serialize(Archive & ar, const unsigned int file_version)
        {
           (void) file_version;
              ar & data_;
              ar & b_i;
              ar & f_er;
              ar & pa_er;
              ar & ct_c;
      }
     
    private:

    uint8_t data_;
    bool b_i;
    bool f_er;
    bool pa_er;
    bool ct_c;

    };

    ----
    class RB : public RM
    {
    public:

      virtual void checkpoint_save(boost::archive::text_oarchive & oa)
      {
         oa & dr;
      }

      virtual void checkpoint_retrive(boost::archive::text_iarchive & ia)
      {
         ia & dr;
      }

    private:

     Dkpt* dr;

    ;}

    Thanks.
    Niranjan

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

  _______________________________________________
  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