
I have a class that I am serializing using the non-intrusive method. It serializes just fine, but when I code the input stream, the compiler complains that the class doesn't implement the serialize function (which is, of course, true since I'm am doing the non-intrusive method on this class). Any idea what could be going wrong? The class I'm wrapping is being serialized as part of another class (if that helps at all). Visual Studio 7.1 Boost 1.32.0 tar ball Wide character XML output Jared McIntyre

Double check the example test_nonintrusive and compare it to your case. Check the following: a) const vs non const parameters b) unsigned vs int declarations for version c) namespace. Since vc 7.1 implements ADL its best for the specializations to be in the same namespace as the datatype being serialized. Robert Ramey "Jared McIntyre" <jmcintyre@dfsoftware.com> wrote in message news:a06110401bdc439f0fdf5@[192.168.1.101]...
I have a class that I am serializing using the non-intrusive method. It serializes just fine, but when I code the input stream, the compiler complains that the class doesn't implement the serialize function (which is, of course, true since I'm am doing the non-intrusive method on this class). Any idea what could be going wrong? The class I'm wrapping is being serialized as part of another class (if that helps at all).
Visual Studio 7.1 Boost 1.32.0 tar ball Wide character XML output
Jared McIntyre _______________________________________________ Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost

I've been out of town, so I haven't had the chance to look back at this issue until today. This is the code for the non-intrusive serializer: template<class Archive> void serialize(Archive & ar, SWHandle & handle, const unsigned int version) { std::string strHelper( handle.toCharString() ); ar & make_nvp("swhandle_guid", strHelper); handle = strHelper.c_str(); } I don't have access to the internal data of SWHandle, so I am trying to work around that in the functions so that it work for both serialization and deserialization (since I'm not aware of an easy way to split them like you can the class version). The namespaces shouldn't be an issue (in this case, everything is operating in the global namespace). I'm not seeing any real difference between my code and the Jared
Double check the example test_nonintrusive and compare it to your case. Check the following:
a) const vs non const parameters b) unsigned vs int declarations for version c) namespace. Since vc 7.1 implements ADL its best for the specializations to be in the same namespace as the datatype being serialized.
Robert Ramey
"Jared McIntyre" <jmcintyre@dfsoftware.com> wrote in message news:a06110401bdc439f0fdf5@[192.168.1.101]...
I have a class that I am serializing using the non-intrusive method. It serializes just fine, but when I code the input stream, the compiler complains that the class doesn't implement the serialize function (which is, of course, true since I'm am doing the non-intrusive method on this class). Any idea what could be going wrong? The class I'm wrapping is being serialized as part of another class (if that helps at all).
Visual Studio 7.1 Boost 1.32.0 tar ball Wide character XML output
Jared McIntyre

I would hope the following would do it template<class Archive> void save(Archive & ar, const SWHandle & handle, const unsigned int version) { std::string strHelper( handle.toCharString() ); ar << make_nvp("swhandle_guid", strHelper); } template<class Archive> void load(Archive & ar, SWHandle & handle, const unsigned int version) { std::string strHelper; ar >> make_nvp("swhandle_guid", strHelper); handle = strHelper.c_str(); } BOOST_SERIALIZATION_SPLIT_FREE(SWHandle) "Jared McIntyre" <jmcintyre@dfsoftware.com> wrote in message news:a06200700bdd51066d7f9@[192.168.1.103]...
I've been out of town, so I haven't had the chance to look back at this issue until today. This is the code for the non-intrusive serializer:
template<class Archive> void serialize(Archive & ar, SWHandle & handle, const unsigned int version) { std::string strHelper( handle.toCharString() ); ar & make_nvp("swhandle_guid", strHelper); handle = strHelper.c_str(); }
I don't have access to the internal data of SWHandle, so I am trying to work around that in the functions so that it work for both serialization and deserialization (since I'm not aware of an easy way to split them like you can the class version). The namespaces shouldn't be an issue (in this case, everything is operating in the global namespace). I'm not seeing any real difference between my code and the
Jared
Double check the example test_nonintrusive and compare it to your case. Check the following:
a) const vs non const parameters b) unsigned vs int declarations for version c) namespace. Since vc 7.1 implements ADL its best for the specializations to be in the same namespace as the datatype being serialized.
Robert Ramey
"Jared McIntyre" <jmcintyre@dfsoftware.com> wrote in message news:a06110401bdc439f0fdf5@[192.168.1.101]...
I have a class that I am serializing using the non-intrusive method. It serializes just fine, but when I code the input stream, the compiler complains that the class doesn't implement the serialize function (which is, of course, true since I'm am doing the non-intrusive method on this class). Any idea what could be going wrong? The class I'm wrapping is being serialized as part of another class (if that helps at all).
Visual Studio 7.1 Boost 1.32.0 tar ball Wide character XML output
Jared McIntyre
Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost

At 11:04 AM -0800 12/2/04, Robert Ramey wrote:
I would hope the following would do it
template<class Archive> void save(Archive & ar, const SWHandle & handle, const unsigned int version) { std::string strHelper( handle.toCharString() ); ar << make_nvp("swhandle_guid", strHelper); }
template<class Archive> void load(Archive & ar, SWHandle & handle, const unsigned int version) { std::string strHelper; ar >> make_nvp("swhandle_guid", strHelper); handle = strHelper.c_str(); }
BOOST_SERIALIZATION_SPLIT_FREE(SWHandle)
Missed that macro in my reading. However, even with that improvement, I'm still getting the same error. Maybe the problem is how I'm invoking the deserialization? *** std::wifstream ifs( strTemp.c_str() ); assert(ifs.good()); archive::xml_wiarchive ia(ifs); ia >> make_nvp("PluginList", *m_pPluginList); ifs.close(); *** m_pPluginList has a serializer defined as: *** protected: friend class boost::serialization::access; template<class Archive> void serialize(Archive & ar, const unsigned int version) { using namespace boost; using namespace boost::serialization; ar & make_nvp("name", m_name); ar & make_nvp("id", m_ID); ar & make_nvp("api_version", m_APIVersion); ar & make_nvp("version", m_version); ar & make_nvp("description", m_description); ar & make_nvp("change_description", m_change); ar & make_nvp("author", m_author); ar & make_nvp("copyright", m_copyright); }; *** The deserialization of m_ID is the issue. Jared

At 11:04 AM -0800 12/2/04, Robert Ramey wrote:
I would hope the following would do it
template<class Archive> void save(Archive & ar, const SWHandle & handle, const unsigned int version) { std::string strHelper( handle.toCharString() ); ar << make_nvp("swhandle_guid", strHelper); }
template<class Archive> void load(Archive & ar, SWHandle & handle, const unsigned int version) { std::string strHelper; ar >> make_nvp("swhandle_guid", strHelper); handle = strHelper.c_str(); }
BOOST_SERIALIZATION_SPLIT_FREE(SWHandle)
I didn't notice this at first since the deserialization compiler error was first, but with this code neither the deserialization nor the serialization will compile. Jared

why not? Robert Ramey "Jared McIntyre" <jmcintyre@dfsoftware.com> wrote in message news:a06200700bdd6457f4a05@[192.168.1.103]...
At 11:04 AM -0800 12/2/04, Robert Ramey wrote:
I would hope the following would do it
template<class Archive> void save(Archive & ar, const SWHandle & handle, const unsigned int version) { std::string strHelper( handle.toCharString() ); ar << make_nvp("swhandle_guid", strHelper); }
template<class Archive> void load(Archive & ar, SWHandle & handle, const unsigned int version) { std::string strHelper; ar >> make_nvp("swhandle_guid", strHelper); handle = strHelper.c_str(); }
BOOST_SERIALIZATION_SPLIT_FREE(SWHandle)
I didn't notice this at first since the deserialization compiler error was first, but with this code neither the deserialization nor the serialization will compile.
Jared _______________________________________________ Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost

Same error, no serialization function defined on the class. Jared
why not?
Robert Ramey
"Jared McIntyre" <jmcintyre@dfsoftware.com> wrote in message news:a06200700bdd6457f4a05@[192.168.1.103]...
At 11:04 AM -0800 12/2/04, Robert Ramey wrote:
I would hope the following would do it
template<class Archive> void save(Archive & ar, const SWHandle & handle, const unsigned int version) { std::string strHelper( handle.toCharString() ); ar << make_nvp("swhandle_guid", strHelper); }
template<class Archive> void load(Archive & ar, SWHandle & handle, const unsigned int version) { std::string strHelper; ar >> make_nvp("swhandle_guid", strHelper); handle = strHelper.c_str(); }
BOOST_SERIALIZATION_SPLIT_FREE(SWHandle)
I didn't notice this at first since the deserialization compiler error was first, but with this code neither the deserialization nor the serialization will compile.
Jared _______________________________________________ Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost
participants (2)
-
Jared McIntyre
-
Robert Ramey