Boost logo

Boost Users :

Subject: [Boost-users] BOOST_SERIALIZATION_BASE_OBJECT_NVP not convenient for template base class and XML archive
From: Alain KOCELNIAK (alain_at_[hidden])
Date: 2010-03-11 06:28:06


 

template < class eArchive >
void MtxAnsFunctionIntegerPipe::serialize( eArchive& aArchive, const
unsigned int aVersion )
{
        aArchive & BOOST_SERIALIZATION_BASE_OBJECT_NVP(
MtxAnmFunctionTpl<int> ) ;
        aArchive & BOOST_SERIALIZATION_NVP( mVariable ) ;
}

#define BOOST_SERIALIZATION_BASE_OBJECT_NVP(name) \
    boost::serialization::make_nvp( \
        BOOST_PP_STRINGIZE(name), \
        boost::serialization::base_object<name >(*this) \

The stringized class name ("MtxAnmFunctionTpl<int>") generate a non valid
XML tag name (due to < > )

There is no BOOST_SERIALIZATION_BASE_OBJECT_NVP2( type, tag) macro
(as BOOST_CLASS_EXPORT_KEY2(class, key) for BOOST_EXPORT_CLASS_KEY(class) ).

Such a macro is necessary to write things like :

        aArchive & BOOST_SERIALIZATION_BASE_OBJECT_NVP2(
MtxAnmFunctionTpl<int>, "MtxAnmFunctionTplInt" ) ;

In the next release ?
 
Alain K.
 

 

 



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