Boost logo

Boost Users :

From: Ng Pan (panng_wts_at_[hidden])
Date: 2007-05-21 06:08:08


Hi

I am facing a problem about serialization. There are several objects
constructed from class base1. And I want to serialize/deserialize only the
member attribute "m_nID" from these objects. That's why only class base is
registered.

My problem is that when I try to serialize the objects construct from class
base1, error message "unregistered_class" is throwed.

It doesn't have such problem if the class base doesn't inherented from class
blackbox. As I know the class blackbox is also using boost library, but I
don't which part it is using.

I have tryed to use marco
BOOST_CLASS_EXPORT_GUID(base, "Base")

but seems not useful in this case.

---------------------------------------------------------------------

class base: public blackbox
{
friend class boost::serialization::access;
template<class Archive>
void serialize(Archive &ar, const unsigned int /* file_version */){
   ar & boost::serialization::make_nvp("ComponentID", m_nID);
    }
....
private:
unsigned int m_nID;
};

class base1: public base
{
//friend class boost::serialization::access;
//template<class Archive>
//void serialize(Archive &ar, const unsigned int /* file_version */){
// ar & boost::serialization::make_nvp("ComponentID", m_nID);
// ar & boost::serialization::make_nvp("BaseInt", m_nBInt);
// }
....
};

Regards
Barr Ng

_________________________________________________________________
Learn English via Shopping Game, FREE!
http://www.linguaphonenet.com/BannerTrack.asp?EMSCode=MSN06-03ETFJ-0211E


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net