File indexing completed on 2025-12-15 10:08:13
0001 #ifndef BOOST_SERIALIZATION_LEVEL_HPP
0002 #define BOOST_SERIALIZATION_LEVEL_HPP
0003
0004
0005 #if defined(_MSC_VER)
0006 # pragma once
0007 #endif
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019 #include <boost/config.hpp>
0020 #include <boost/detail/workaround.hpp>
0021
0022 #include <boost/type_traits/is_fundamental.hpp>
0023 #include <boost/type_traits/is_enum.hpp>
0024 #include <boost/type_traits/is_array.hpp>
0025 #include <boost/type_traits/is_class.hpp>
0026 #include <boost/type_traits/is_base_and_derived.hpp>
0027
0028 #include <boost/mpl/eval_if.hpp>
0029 #include <boost/mpl/int.hpp>
0030 #include <boost/mpl/integral_c.hpp>
0031 #include <boost/mpl/integral_c_tag.hpp>
0032
0033 #include <boost/serialization/level_enum.hpp>
0034
0035 namespace boost {
0036 namespace serialization {
0037
0038 struct basic_traits;
0039
0040
0041 template<class T>
0042 struct implementation_level_impl {
0043 template<class U>
0044 struct traits_class_level {
0045 typedef typename U::level type;
0046 };
0047
0048 typedef mpl::integral_c_tag tag;
0049
0050
0051 typedef
0052 typename mpl::eval_if<
0053 is_base_and_derived<boost::serialization::basic_traits, T>,
0054 traits_class_level< T >,
0055
0056 typename mpl::eval_if<
0057 is_fundamental< T >,
0058 mpl::int_<primitive_type>,
0059
0060 typename mpl::eval_if<
0061 is_class< T >,
0062 mpl::int_<object_class_info>,
0063
0064 typename mpl::eval_if<
0065 is_array< T >,
0066 mpl::int_<object_serializable>,
0067
0068 typename mpl::eval_if<
0069 is_enum< T >,
0070 mpl::int_<primitive_type>,
0071
0072 mpl::int_<not_serializable>
0073 >
0074 >
0075 >
0076 >
0077 >::type type;
0078
0079 BOOST_STATIC_CONSTANT(int, value = type::value);
0080 };
0081
0082 template<class T>
0083 struct implementation_level :
0084 public implementation_level_impl<const T>
0085 {
0086 };
0087
0088 template<class T, int L>
0089 inline bool operator>=(implementation_level< T > t, enum level_type l)
0090 {
0091 return t.value >= (int)l;
0092 }
0093
0094 }
0095 }
0096
0097
0098
0099 #define BOOST_CLASS_IMPLEMENTATION(T, E) \
0100 namespace boost { \
0101 namespace serialization { \
0102 template <> \
0103 struct implementation_level_impl< const T > \
0104 { \
0105 typedef mpl::integral_c_tag tag; \
0106 typedef mpl::int_< E > type; \
0107 BOOST_STATIC_CONSTANT( \
0108 int, \
0109 value = implementation_level_impl::type::value \
0110 ); \
0111 }; \
0112 } \
0113 }
0114
0115
0116 #endif