Started IPC services serialization

This commit is contained in:
Hamish Milne 2019-12-24 17:49:56 +00:00 committed by zhupengfei
parent 7a5bde0b44
commit ac0337d8df
8 changed files with 112 additions and 7 deletions

35
src/common/construct.h Normal file
View file

@ -0,0 +1,35 @@
#include <boost/serialization/serialization.hpp>
#define BOOST_SERIALIZATION_FRIENDS \
friend class boost::serialization::access; \
friend class construct_access;
class construct_access {
public:
template<class Archive, class T>
static inline void save_construct(Archive & ar, const T * t, const unsigned int file_version) {
t->save_construct(ar, file_version);
}
template<class Archive, class T>
static inline void load_construct(Archive & ar, T * t, const unsigned int file_version) {
T::load_construct(ar, t, file_version);
}
};
#define BOOST_SERIALIZATION_CONSTRUCT(T) \
namespace boost { namespace serialization { \
\
template<class Archive> \
inline void save_construct_data( \
Archive & ar, const T * t, const unsigned int file_version \
){ \
construct_access::save_construct(ar, t, file_version); \
} \
\
template<class Archive> \
inline void load_construct_data( \
Archive & ar, T * t, const unsigned int file_version \
){ \
construct_access::load_construct(ar, t, file_version); \
} \
}}