Hi,
I run into compilation error with the Intel compiler for doing serialization traits and tracking. I have the following code which does serialization of virtual base classes :
#include <boost/archive/text_iarchive.hpp>
#include <boost/archive/text_oarchive.hpp>
#include <boost/serialization/utility.hpp>
#include <boost/serialization/split_member.hpp>
#include <boost/serialization/tracking.hpp>
#include <boost/serialization/nvp.hpp>
#include <boost/serialization/export.hpp>
typedef unsigned _int64 ut8;
typedef unsigned char otext;
typedef unsigned int ut4;
class Object
{
private:
void* _ojhi;
ut8 _seqno;
public:
template<class Archive>
void save(Archive &ar, const unsigned int /* file
version */) const
{
ar << BOOST_SERIALIZATION_NVP(_ojhi) << BOOST_SERIALIZATION_NVP(_seqno);
}
template<class Archive>
void load(Archive& ar, const unsigned int /* file version */)
{
ar >> BOOST_SERIALIZATION_NVP(_ojhi) >> BOOST_SERIALIZATION_NVP(_seqno);
}
BOOST_SERIALIZATION_SPLIT_MEMBER()
protected:
Object(const Object& ) : _ojhi(NULL), _seqno(0) {}
Object(const char *num=NULL, int is_stub=1) :
_ojhi(NULL), _seqno(0) {}
virtual ~Object() {}
void operator=(const Object& ) {}
};
BOOST_IS_ABSTRACT(Object)
BOOST_CLASS_TRACKING(Object, track_always)
class EModule {
public:
class IInterface : public virtual Object {
private:
static const otext * _Desc;
static const ut4 _pkgIndex;
static const ut4 _clsIndex;
protected:
IInterface() {}
IInterface(const IInterface&) {}
public:
template<class Archive>
void save(Archive& ar, const unsigned int /*file_version*/) const
{
ar << const_cast(otext *> (_Desc) << const_cast<ut4> (_pkgIndex) << const_cast<ut4> (_clsIndex);
ar << BOOST_SERIALIZATION_BASE_OBJECT_NVP(Object);
}
template<class Archive>
void load(Archive& ar, const unsigned int /*file_version*/) const
{
ar << const_cast(otext *> (_Desc)
<< const_cast<ut4> (_pkgIndex) << const_cast<ut4> (_clsIndex);
ar << BOOST_SERIALIZATION_BASE_OBJECT_NVP(Object);
}
};
};
BOOST_CLASS_TRACKING(EModule::IInterface, track_always)
class CModule {
public:
class CInterface : public virtual EModule::IInterface, public virtual Object {
private:
static const otext * _Desc;
static const ut4 _pkgIndex;
static const ut4 _clsIndex;
protected:
CInterface() {}
CInterface(const CInterface&) {}
public:
template <class Archive>
void save(Archive& ar, const unsigned int /* file_version */) const
{
ar << const_cast<otext *> (_Desc) << const_cast<ut4>
(_pkgIndex) << const_cast<ut4> (_clsIndex);
ar << BOOST_SERIALIZATION_BASE_OBJECT_NVP(EModule::IInterface);
ar << BOOST_SERIALIZATION_BASE_OBJECT_NVP(Object);
}
template <class Archive>
void load(Archive & ar, const unsigned int /* file_version */)
{
ar >> const_cast<otext *> (_Desc) >> const_cast<ut4> (_pkgIndex) >> const_cast<ut4> (_clsIndex);
ar >> BOOST_SERIALIZATION_BASE_OBJECT_NVP(EModule::IInterface);
ar >> BOOST_SERIALIZATION_BASE_OBJECT_NVP(Object);
}
BOOST_SERIALIZATION_SPLIT_MEMBER()
virtual ~CInterface() {}
};
};
BOOST_CLASS_EXPORT(CModule::CInterface)
I followed strictly from the documentation. Is there a way I can get it compiled?
Enclosed please find the compile log.
Yahoo! Mail
Use Photomail to share photos without annoying attachments.