|
Boost Users : |
From: Terence Wilson (tez_at_[hidden])
Date: 2006-01-20 14:22:33
I've been scratching my head trying to figure this one out for a few days.
My code serializes xml_iarchive & text_iarchive with no problems, however,
when I substitute the binary_iarchive I get a "stream error" serialization
exception thrown during the make_binary_object call when reading a binary
file:
template<class Archive> void serialize(Archive & ar, const unsigned
int)
{
ar & BOOST_SERIALIZATION_BASE_OBJECT_NVP(CImageDataBase2D);
if (Archive::is_loading::value)
{
Alloc();
}
//ar & boost::serialization::make_nvp("ImageData",
boost::serialization::make_binary_object(m_pData, sizeof(T)*m_x*m_y));
const int blobSize=sizeof(T)*m_x*m_y;
_ASSERTE(blobSize);
ar & boost::serialization::make_nvp("ImageData",
boost::serialization::make_binary_object(m_pData, blobSize));
}
I've tried to excise the relevant code to a console project, however, it has
tentacles and will take a few more days. In the mean time I would appreciate
help from anyone that might have a suggestion.
I've looked at the code and can find nothing wrong, as I said, ASCII and XML
serialization works flawlessly
I'm using Visual Studio 8 with Boost 1.33.1.
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