I’mm using boost to serialize and deserialize some classes
Like so:
boost::archive::xml_oarchive xmlArchive(oStringStream);
xmlArchive.register_type(static_cast<BaseMessage *>(NULL));
xmlArchive.register_type(static_cast<IncomingTradeMessage *>(NULL));
xmlArchive.register_type(static_cast<InternalRequestInfo *>(NULL));
xmlArchive.register_type(static_cast<InternalTradeTransInfo *>(NULL));
const BaseMessage* myMessage =message;
xmlArchive << make_nvp("Message", myMessage);
now my clasess get a class_id according to the order used, i dont want that, i want to control the Class_id’s
so i can do something like
BOOST_SET_CLASS_ID(1234, BaseMessage);
and everywhere in my project BaseMessage would have class_id of 1234.
How can i do such a thing
Can’t you use
BOOST_CLASS_EXPORT_GUIDor similar instead? I.e.It will use some more bandwidth since strings are transmitted rather than integers, but it will solve your problem.
Refer to this and this for more info.
EDIT:
This compile just fine: