File indexing completed on 2025-01-18 09:30:30
0001 #ifndef BOOST_CORE_SERIALIZATION_HPP_INCLUDED
0002 #define BOOST_CORE_SERIALIZATION_HPP_INCLUDED
0003
0004
0005
0006 #if defined(_MSC_VER) && (_MSC_VER >= 1020)
0007 # pragma once
0008 #endif
0009
0010
0011
0012
0013
0014
0015
0016
0017 #include <boost/core/nvp.hpp>
0018 #include <cstddef>
0019
0020 namespace boost
0021 {
0022
0023 namespace serialization
0024 {
0025
0026
0027
0028 template<class T> struct version;
0029
0030 class access;
0031
0032
0033
0034
0035
0036 struct core_version_type
0037 {
0038 unsigned int version_;
0039
0040 core_version_type( unsigned int version ): version_( version ) {}
0041 operator unsigned int () const { return version_; }
0042 };
0043
0044 }
0045
0046 namespace core
0047 {
0048
0049
0050
0051 using serialization::nvp;
0052 using serialization::make_nvp;
0053
0054
0055
0056 namespace detail
0057 {
0058
0059 template<bool IsSaving> struct load_or_save_f;
0060
0061 template<> struct load_or_save_f<true>
0062 {
0063 template<class A, class T> void operator()( A& a, T& t, unsigned int v ) const
0064 {
0065 save( a, t, serialization::core_version_type( v ) );
0066 }
0067 };
0068
0069 template<> struct load_or_save_f<false>
0070 {
0071 template<class A, class T> void operator()( A& a, T& t, unsigned int v ) const
0072 {
0073 load( a, t, serialization::core_version_type( v ) );
0074 }
0075 };
0076
0077 }
0078
0079 template<class A, class T> inline void split_free( A& a, T& t, unsigned int v )
0080 {
0081 detail::load_or_save_f< A::is_saving::value >()( a, t, v );
0082 }
0083
0084
0085
0086 namespace detail
0087 {
0088
0089 template<bool IsSaving, class Access = serialization::access> struct load_or_save_m;
0090
0091 template<class Access> struct load_or_save_m<true, Access>
0092 {
0093 template<class A, class T> void operator()( A& a, T const& t, unsigned int v ) const
0094 {
0095 Access::member_save( a, t, v );
0096 }
0097 };
0098
0099 template<class Access> struct load_or_save_m<false, Access>
0100 {
0101 template<class A, class T> void operator()( A& a, T& t, unsigned int v ) const
0102 {
0103 Access::member_load( a, t, v );
0104 }
0105 };
0106
0107 }
0108
0109 template<class A, class T> inline void split_member( A& a, T& t, unsigned int v )
0110 {
0111 detail::load_or_save_m< A::is_saving::value >()( a, t, v );
0112 }
0113
0114
0115
0116 template<class Ar, class T> void load_construct_data_adl( Ar& ar, T* t, unsigned int v )
0117 {
0118 load_construct_data( ar, t, serialization::core_version_type( v ) );
0119 }
0120
0121
0122
0123 template<class Ar, class T> void save_construct_data_adl( Ar& ar, T const* t, unsigned int v )
0124 {
0125 save_construct_data( ar, t, serialization::core_version_type( v ) );
0126 }
0127
0128 }
0129 }
0130
0131 #endif