Added POD serialization
This commit is contained in:
parent
6940c99ed6
commit
dc04774ece
8 changed files with 68 additions and 20 deletions
|
@ -84,6 +84,7 @@ add_library(common STATIC
|
|||
misc.cpp
|
||||
param_package.cpp
|
||||
param_package.h
|
||||
pod.h
|
||||
quaternion.h
|
||||
ring_buffer.h
|
||||
scm_rev.cpp
|
||||
|
|
20
src/common/pod.h
Normal file
20
src/common/pod.h
Normal file
|
@ -0,0 +1,20 @@
|
|||
#include "boost/serialization/split_member.hpp"
|
||||
|
||||
#define SERIALIZE_AS_POD \
|
||||
private: \
|
||||
friend class boost::serialization::access; \
|
||||
template<typename Archive> \
|
||||
void save(Archive & ar, const unsigned int file_version) const { \
|
||||
ar.save_binary(this, sizeof(*this)); \
|
||||
} \
|
||||
template<typename Archive> \
|
||||
void load(Archive & ar, const unsigned int file_version) { \
|
||||
ar.load_binary(this, sizeof(*this)); \
|
||||
} \
|
||||
template<class Archive> \
|
||||
void serialize( \
|
||||
Archive &ar, \
|
||||
const unsigned int file_version \
|
||||
){ \
|
||||
boost::serialization::split_member(ar, *this, file_version); \
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue