Boost logo

Boost Users :

Subject: Re: [Boost-users] Problem with Boost Serialization
From: Binh Luong (tbinhluong_at_[hidden])
Date: 2010-03-02 18:44:41


Hi,

Matthias Troyer-2 wrote:
>
> You should not have to define your class as a wrapper. Can you send the
> code fragment that causes the problem?
>
> Matthias
> _______________________________________________
> Boost-users mailing list
> Boost-users_at_[hidden]
> http://lists.boost.org/mailman/listinfo.cgi/boost-users
>

here are the code segments that cause the problem:
As you see in the last message, there are errors in
RemoteMessagingSystem.cpp:147 and RemoteMessagingSystem.cpp:147. They are
the following 2 functions which serializes the obj Message to xml archive
and deserializes xml archive backwards to obj Message.

string RemoteMessagingSystem::serialize (Message* msg)
{
        stringstream archiveStream (ios_base::binary | ios_base::out);
        {
#ifdef REMOTE_XML
                boost::archive::xml_oarchive outputArchive( archiveStream );
#else
                boost::archive::binary_oarchive outputArchive( archiveStream );
#endif //REMOTE_XML
            outputArchive & msg; //line 147
        }
        
        string data = archiveStream.str();
        return data;
}

Message* RemoteMessagingSystem::deserialize (string data)
{
        stringstream archivStream (data, ios_base::binary | ios_base::in);
#ifdef REMOTE_XML
        boost::archive::xml_iarchive inputArchive( archivStream );
#else
        boost::archive::binary_iarchive inputArchive( archivStream );
#endif

        Message* msg = NULL;
        inputArchive >> msg; // line 164

        return msg;
}

Regards,
Binh

-- 
View this message in context: http://old.nabble.com/Problem-with-Boost-Serialization-tp27743377p27762759.html
Sent from the Boost - Users mailing list archive at Nabble.com.

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