RE: [boost] Re: Non-intrusive serialization with VC2003 (7.1)

I've been looking through the template instantiation trace, and I can't figure out where the choice to use the intrusive mechanism is made. I'll keep looking a little more, and I've appended the trace below: ------ Build started: Project: NewClient, Configuration: Debug Win32 ------ Compiling... EnhancedMessageHandler.cpp c:\D2\API\NewClient\EnhancedMessageHandler.cpp(151) : warning C4244: '=' : conversion from 'uintptr_t' to 'unsigned long', possible loss of data c:\new_boost\boost\boost\serialization\access.hpp(107) : error C2039: 'serialize' : is not a member of 'Jrs::SmartPtr<T>' with [ T=D2::Message ] c:\new_boost\boost\boost\serialization\serialization.hpp(81) : see reference to function template instantiation 'void boost::serialization::access::serialize<Archive,T>(Archive &,T &,const unsigned int)' being compiled with [ Archive=boost::archive::text_oarchive, T=const D2::MessagePtr ] c:\new_boost\boost\boost\serialization\serialization.hpp(140) : see reference to function template instantiation 'void boost::serialization::serialize<Archive,T>(Archive &,T &,const unsigned int)' being compiled with [ Archive=boost::archive::text_oarchive, T=const D2::MessagePtr ] c:\new_boost\boost\boost\archive\detail\oserializer.hpp(152) : see reference to function template instantiation 'void boost::serialization::serialize_adl<Archive,T>(Archive &,T &,const unsigned int)' being compiled with [ Archive=boost::archive::text_oarchive, T=const D2::MessagePtr ] c:\new_boost\boost\boost\serialization\extended_type_info_typeid.hpp(71) : while compiling class-template member function 'void boost::archive::detail::oserializer<Archive,T>::save_object_data(boost:: archive::detail::basic_oarchive &,const void *) const' with [ Archive=boost::archive::text_oarchive, T=D2::MessagePtr ] c:\new_boost\boost\boost\archive\detail\oserializer.hpp(236) : see reference to class template instantiation 'boost::archive::detail::oserializer<Archive,T>' being compiled with [ Archive=boost::archive::text_oarchive, T=D2::MessagePtr ] c:\new_boost\boost\boost\archive\detail\oserializer.hpp(235) : while compiling class-template member function 'void boost::archive::detail::save_non_pointer_type<Archive,T>::save_standard: :invoke(Archive &,const Jrs::SmartPtr<D2::Message> &)' with [ Archive=boost::archive::text_oarchive, T=D2::MessageP tr ] c:\new_boost\boost\boost\archive\detail\oserializer.hpp(294) : see reference to class template instantiation 'boost::archive::detail::save_non_pointer_type<Archive,T>::save_standard ' being compiled with [ Archive=boost::archive::text_oarchive, T=D2::MessagePtr ] c:\new_boost\boost\boost\archive\detail\oserializer.hpp(282) : while compiling class-template member function 'void boost::archive::detail::save_non_pointer_type<Archive,T>::invoke(Archive &,const Jrs::SmartPtr<D2::Message> &)' with [ Archive=boost::archive::text_oarchive, T=D2::MessagePtr ] c:\new_boost\boost\boost\archive\detail\oserializer.hpp(534) : see reference to class template instantiation 'boost::archive::detail::save_non_pointer_type<Archive,T>' being compiled with [ Archive=boost::archive::text_oarchive, T=D2::MessagePtr ] c:\new_boost\boost\boost\archive\basic_text_oarchive.hpp(78) : see reference to function template instantiation 'void boost::archive::save<Archive,T>(Archive &,T &)' being compiled with [ Archive=boost::archive::text_oarchive, T=const D2::MessagePtr ] c:\new_boost\boost\boost\archive\detail\interface_oarchive.hpp(89) : see reference to function template instantiation 'void boost::archive::basic_text_oarchive<Archive>::save_override<T>(T &,int)' being compiled with [ Archive=boost::archive::text_oarchive, T=const D2::MessagePtr ] c:\D2\API\NewClient\EnhancedMessageHandler.cpp(115) : see reference to function template instantiation 'Archive &boost::archive::detail::interface_oarchive<Archive>::operator <<<const D2::MessagePtr>(T &)' being compiled with [ Archive=boost::archive::text_oarchive, T=const D2::MessagePtr ]

I'm probably completely wrong, but but am I right in thinking the problem is due Jrs::SmartPtr<T> and not the fact that VS.NET or the serialization library is not find the right serialize method. If so I'm surprised no one else has pointed this out before! It's clearly stated in the last string of emails that there is no serialize method defined for the smart pointer you are using, and therefore you need to write some code to serialise the smart pointer object that holds the message object. If you don't want to do this, and depending on the characteristics of your smart pointer class, and where/how it's referenced in your code (i.e. it could be as simple as changing a typedef and few other small pieces if you are lucky), you could try porting your code to use one of the boost smart pointers, such as boost::shared_ptr. Anyway, forgive me if I'm wrong, and totally missing the point. Oh, on a completely off-topic note, I just realised Marcin that you're only a few miles down the road from me. I'm in based in Bournemouth. Jason On 19 Me 2005, at 15:44, Marcin Tustin wrote:
I've been looking through the template instantiation trace, and I can't figure out where the choice to use the intrusive mechanism is made. I'll keep looking a little more, and I've appended the trace below:
------ Build started: Project: NewClient, Configuration: Debug Win32 ------
Compiling... EnhancedMessageHandler.cpp c:\D2\API\NewClient\EnhancedMessageHandler.cpp(151) : warning C4244: '=' : conversion from 'uintptr_t' to 'unsigned long', possible loss of data c:\new_boost\boost\boost\serialization\access.hpp(107) : error C2039: 'serialize' : is not a member of 'Jrs::SmartPtr<T>' with [ T=D2::Message ] c:\new_boost\boost\boost\serialization\serialization.hpp(81) : see reference to function template instantiation 'void boost::serialization::access::serialize<Archive,T>(Archive &,T &,const unsigned int)' being compiled with [ Archive=boost::archive::text_oarchive, T=const D2::MessagePtr ] c:\new_boost\boost\boost\serialization\serialization.hpp(140) : see reference to function template instantiation 'void boost::serialization::serialize<Archive,T>(Archive &,T &,const unsigned int)' being compiled with [ Archive=boost::archive::text_oarchive, T=const D2::MessagePtr ] c:\new_boost\boost\boost\archive\detail\oserializer.hpp(152) : see reference to function template instantiation 'void boost::serialization::serialize_adl<Archive,T>(Archive &,T &,const unsigned int)' being compiled with [ Archive=boost::archive::text_oarchive, T=const D2::MessagePtr ]
c: \new_boost\boost\boost\serialization\extended_type_info_typeid.hpp(71) : while compiling class-template member function 'void boost::archive::detail::oserializer<Archive,T>:: save_object_data(boost:: archive::detail::basic_oarchive &,const void *) const' with [ Archive=boost::archive::text_oarchive, T=D2::MessagePtr ] c:\new_boost\boost\boost\archive\detail\oserializer.hpp(236) : see reference to class template instantiation 'boost::archive::detail::oserializer<Archive,T>' being compiled with [ Archive=boost::archive::text_oarchive, T=D2::MessagePtr ] c:\new_boost\boost\boost\archive\detail\oserializer.hpp(235) : while compiling class-template member function 'void boost::archive::detail::save_non_pointer_type<Archive,T>:: save_standard: :invoke(Archive &,const Jrs::SmartPtr<D2::Message> &)' with [ Archive=boost::archive::text_oarchive, T=D2::MessageP tr ] c:\new_boost\boost\boost\archive\detail\oserializer.hpp(294) : see reference to class template instantiation 'boost::archive::detail::save_non_pointer_type<Archive,T>:: save_standard ' being compiled with [ Archive=boost::archive::text_oarchive, T=D2::MessagePtr ] c:\new_boost\boost\boost\archive\detail\oserializer.hpp(282) : while compiling class-template member function 'void boost::archive::detail::save_non_pointer_type<Archive,T>:: invoke(Archive &,const Jrs::SmartPtr<D2::Message> &)' with [ Archive=boost::archive::text_oarchive, T=D2::MessagePtr ] c:\new_boost\boost\boost\archive\detail\oserializer.hpp(534) : see reference to class template instantiation 'boost::archive::detail::save_non_pointer_type<Archive,T>' being compiled with [ Archive=boost::archive::text_oarchive, T=D2::MessagePtr ] c:\new_boost\boost\boost\archive\basic_text_oarchive.hpp(78) : see reference to function template instantiation 'void boost::archive::save<Archive,T>(Archive &,T &)' being compiled with [ Archive=boost::archive::text_oarchive, T=const D2::MessagePtr ]
c:\new_boost\boost\boost\archive\detail\interface_oarchive.hpp(89) : see reference to function template instantiation 'void boost::archive::basic_text_oarchive<Archive>::save_override<T>(T &,int)' being compiled with [ Archive=boost::archive::text_oarchive, T=const D2::MessagePtr ] c:\D2\API\NewClient\EnhancedMessageHandler.cpp(115) : see reference to function template instantiation 'Archive &boost::archive::detail::interface_oarchive<Archive>::operator <<<const D2::MessagePtr>(T &)' being compiled with [ Archive=boost::archive::text_oarchive, T=const D2::MessagePtr ]
_______________________________________________ Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost

Marcin Tustin wrote:
I've been looking through the template instantiation trace, and I can't figure out where the choice to use the intrusive mechanism is made. I'll keep looking a little more, and I've appended the trace below:
------ Build started: Project: NewClient, Configuration: Debug Win32 ------
Compiling... EnhancedMessageHandler.cpp c:\D2\API\NewClient\EnhancedMessageHandler.cpp(151) : warning C4244: '='
conversion from 'uintptr_t' to 'unsigned long', possible loss of data c:\new_boost\boost\boost\serialization\access.hpp(107) : error C2039: 'serialize' : is not a member of 'Jrs::SmartPtr<T>' with [ T=D2::Message ] c:\new_boost\boost\boost\serialization\serialization.hpp(81) : see reference to function template instantiation 'void boost::serialization::access::serialize<Archive,T>(Archive &,T &,const unsigned int)' being compiled with [ Archive=boost::archive::text_oarchive, T=const D2::MessagePtr ] c:\new_boost\boost\boost\serialization\serialization.hpp(140) : see reference to function template instantiation 'void boost::serialization::serialize<Archive,T>(Archive &,T &,const unsigned int)' being compiled with [ Archive=boost::archive::text_oarchive, T=const D2::MessagePtr ] c:\new_boost\boost\boost\archive\detail\oserializer.hpp(152) :
The choice is made here.
namespace boost { namespace serialization { template<class Archive > static void serialize(Archive & ar, const D2::Message& g, const unsigned int version) { //... }
} };
Note that your serialize template above uses datatype D2::Message while one is trying to serialize D2::MessagePtr.
see reference to function template instantiation 'void boost::serialization::serialize_adl<Archive,T>(Archive &,T &,const unsigned int)' being compiled with [ Archive=boost::archive::text_oarchive, T=const D2::MessagePtr ]
while compiling class-template member function 'void boost::archive::detail::oserializer<Archive,T>::save_object_data(boost:: archive::detail::basic_oarchive &,const void *) const' with [ Archive=boost::archive::text_oarchive, T=D2::MessagePtr ] c:\new_boost\boost\boost\archive\detail\oserializer.hpp(236) : see reference to class template instantiation 'boost::archive::detail::oserializer<Archive,T>' being compiled with [ Archive=boost::archive::text_oarchive, T=D2::MessagePtr ] c:\new_boost\boost\boost\archive\detail\oserializer.hpp(235) : while compiling class-template member function 'void boost::archive::detail::save_non_pointer_type<Archive,T>::save_standard: invoke(Archive &,const Jrs::SmartPtr<D2::Message> &)' with [ Archive=boost::archive::text_oarchive, T=D2::MessageP
c:\new_boost\boost\boost\serialization\extended_type_info_typeid.hpp(71) tr ] c:\new_boost\boost\boost\archive\detail\oserializer.hpp(294) : see reference to class template instantiation 'boost::archive::detail::save_non_pointer_type<Archive,T>::save_standard ' being compiled with [ Archive=boost::archive::text_oarchive, T=D2::MessagePtr ] c:\new_boost\boost\boost\archive\detail\oserializer.hpp(282) : while compiling class-template member function 'void boost::archive::detail::save_non_pointer_type<Archive,T>::invoke(Archive &,const Jrs::SmartPtr<D2::Message> &)' with [ Archive=boost::archive::text_oarchive, T=D2::MessagePtr ] c:\new_boost\boost\boost\archive\detail\oserializer.hpp(534) : see reference to class template instantiation 'boost::archive::detail::save_non_pointer_type<Archive,T>' being compiled with [ Archive=boost::archive::text_oarchive, T=D2::MessagePtr ] c:\new_boost\boost\boost\archive\basic_text_oarchive.hpp(78) : see reference to function template instantiation 'void boost::archive::save<Archive,T>(Archive &,T &)' being compiled with [ Archive=boost::archive::text_oarchive, T=const D2::MessagePtr ]
c:\new_boost\boost\boost\archive\detail\interface_oarchive.hpp(89) : see reference to function template instantiation 'void boost::archive::basic_text_oarchive<Archive>::save_override<T>(T &,int)' being compiled with [ Archive=boost::archive::text_oarchive, T=const D2::MessagePtr ] c:\D2\API\NewClient\EnhancedMessageHandler.cpp(115) : see reference to function template instantiation 'Archive &boost::archive::detail::interface_oarchive<Archive>::operator <<<const D2::MessagePtr>(T &)' being compiled with [ Archive=boost::archive::text_oarchive, T=const D2::MessagePtr ]
_______________________________________________ Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost
participants (3)
-
Jason Earl
-
Marcin Tustin
-
Robert Ramey