Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038 #ifndef MEM_SERIALIZED_STRUCT_HPP_
00039 #define MEM_SERIALIZED_STRUCT_HPP_
00040 #include <labust/preprocessor/class_adaptor.hpp>
00041 #include <boost/serialization/level.hpp>
00042 #include <boost/preprocessor/seq/for_each.hpp>
00043
00044 #define PP_LABUST_ADD_TO_BOOST_ARCHIVE(R, ATTRIBUTE_TUPEL_SIZE, ATTRIBUTE) \
00045 ar & object.BOOST_PP_TUPLE_ELEM(ATTRIBUTE_TUPEL_SIZE,1,ATTRIBUTE);
00046
00047 #define PP_LABUST_MAKE_INLINE_BOOST_SERIALIZATOR(NAME, ATTRIBUTES) \
00048 namespace boost { namespace serialization{\\
00049 template<class Archive>\
00050 inline void serialize(Archive & ar, NAME & g, const unsigned int version) \
00051 {\
00052 BOOST_PP_SEQ_FOR_EACH_R(1, PP_LABUST_ADD_TO_BOOST_ARCHIVE, object, STRUCT_SEQ)\
00053 }}}\
00054
00055 #define PP_LABUST_MAKE_BOOST_SERIALIZATOR(NAME, ATTRIBUTES) \
00056 namespace boost { \
00057 namespace serialization { \
00058 template<class Archive>\
00059 void serialize(Archive & ar, NAME & object, const unsigned int version) \
00060 {\
00061 PP_LABUST_MACRO_ON_ATTRIBUTES(PP_LABUST_ADD_TO_BOOST_ARCHIVE,ATTRIBUTES)\
00062 }}}
00063
00064 #define PP_LABUST_MAKE_INLINE_BOOST_SERIALIZATOR_CLEAN(NAME, ATTRIBUTES) \
00065 PP_LABUST_MAKE_INLINE_BOOST_SERIALIZATOR(NAME, ATTRIBUTES) \
00066 BOOST_CLASS_IMPLEMENTATION(NAME, boost::serialization::object_serializable)
00067
00068 #define PP_LABUST_MAKE_BOOST_SERIALIZATOR_CLEAN(NAME, ATTRIBUTES) \
00069 PP_LABUST_MAKE_BOOST_SERIALIZATOR(NAME, ATTRIBUTES) \
00070 BOOST_CLASS_IMPLEMENTATION(NAME, boost::serialization::object_serializable)
00071
00072 #define PP_LABUST_DEFINE_BOOST_SERIALIZED_STRUCT(NAMESPACE_SEQ, NAME, ATTRIBUTES)\
00073 PP_LABUST_NAMESPACE_DEFINITIONS_BEGIN((0)NAMESPACE_SEQ)\
00074 struct NAME\
00075 {\
00076 PP_LABUST_MACRO_ON_ATTRIBUTES(PP_LABUST_ATTRIBUTE_EXPAND,ATTRIBUTES)\
00077 };\
00078 PP_LABUST_NAMESPACE_DEFINITIONS_END((0)NAMESPACE_SEQ)\
00079 PP_LABUST_MAKE_BOOST_SERIALIZATOR(PP_LABUST_NAMESPACE_DEFINITIONS_ENUM((0)NAMESPACE_SEQ)NAME,ATTRIBUTES)
00080
00081 #define PP_LABUST_DEFINE_BOOST_SERIALIZED_STRUCT_CLEAN(NAMESPACE_SEQ, NAME, ATTRIBUTES)\
00082 PP_LABUST_DEFINE_BOOST_SERIALIZED_STRUCT(NAMESPACE_SEQ, NAME, ATTRIBUTES)\
00083 BOOST_CLASS_IMPLEMENTATION(PP_LABUST_NAMESPACE_DEFINITIONS_ENUM((0)NAMESPACE_SEQ)NAME, boost::serialization::object_serializable)
00084
00085
00086
00087 #endif