Hi, I am having trouble
serializing a class. Actually, I am having trouble compiling the class as
below. The actual archiving is behind an interface (hence the Save and
Load methods) which may work (once I get this sorted, I’m going to look
at the export traits), but the error points to me not declaring the is_wrapper
properly.
My class:
BOOST_CLASS_IS_WRAPPER(Frame);
class Frame
{
…
// Serialize interface
uint32 Save( uint8* pStream )
{
ostrstream os( (char*)pStream, STREAM_SIZE );
boost::archive::text_oarchive
oa(os);
oa << this;
return
os.pcount();
}
void Load( uint8* pStream )
{
istrstream is( (char*)pStream, STREAM_SIZE );
boost::archive::text_iarchive
ia(is);
ia >> this;
}
friend class
boost::serialization::access;
template< class
Archive >
void serialize( Archive& ar, const unsigned int version )
{
string strObjectType = "IFrame";
ar <<
strObjectType.length() << strObjectType;
ar << m_lMaxFrameLength
<< m_lDataLength << m_uiTimeStamp;
ar <<
boost::serialization::make_binary_object( (void*)(this + 1), m_lMaxFrameLength );
}
My error:
W:\NewFramework\Boost\boost/archive/detail/iserializer.hpp(541)
: error C2664: 'boost::archive::load_wrapper' : cannot convert parameter 3 from
'boost::serialization::is_wrapper<T>' to 'boost::mpl::true_'
1> with
1> [
1>
T= Frame *
1> ]
1> No
user-defined-conversion operator available that can perform this conversion, or
the operator cannot be called
1>
W:\NewFramework\Boost\boost/archive/detail/common_iarchive.hpp(59) : see
reference to function template instantiation 'void
boost::archive::load<Archive,const T>(Archive &,const T &)' being
compiled
1> with
1> [
1>
Archive=boost::archive::text_iarchive,
1>
T= Frame *const
1> ]
1>
W:\NewFramework\Boost\boost/archive/basic_text_iarchive.hpp(62) : see reference
to function template instantiation 'void
boost::archive::detail::common_iarchive<Archive>::load_override<T>(T
&,int)' being compiled
1> with
1> [
1>
Archive=boost::archive::text_iarchive,
1>
T= Frame *const
1> ]
1>
W:\NewFramework\Boost\boost/archive/text_iarchive.hpp(65) : see reference to
function template instantiation 'void boost::archive::basic_text_iarchive<Archive>::load_override<T>(T
&,int)' being compiled
1> with
1> [
1>
Archive=boost::archive::text_iarchive,
1>
T= Frame *const
1> ]
1> W:\NewFramework\Boost\boost/archive/detail/interface_iarchive.hpp(61)
: see reference to function template instantiation 'void
boost::archive::text_iarchive_impl<Archive>::load_override<T>(T
&,int)' being compiled
1> with
1> [
1>
Archive=boost::archive::text_iarchive,
1>
T= Frame *const
1> ]
1>
w:\newframework\framework\sourcecode\includes\RDCFrameFactoryImpl\RDCFrame.h(262)
: see reference to function template instantiation 'Archive
&boost::archive::detail::interface_iarchive<Archive>::operator
>>< Frame*const >(T &)' being compiled
1> with
1> [
1>
Archive=boost::archive::text_iarchive,
1>
T= Frame *const
1>
]
Thanks,
Ryan
Ryan Fowler
Software Engineer
Thomson Reuters
Phone: +442075427063
ryan.fowler@thomsonreuters.com
thomsonreuters.com