Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-12-15 10:08:13

0001 #ifndef BOOST_SERIALIZATION_LEVEL_HPP
0002 #define BOOST_SERIALIZATION_LEVEL_HPP
0003 
0004 // MS compatible compilers support #pragma once
0005 #if defined(_MSC_VER)
0006 # pragma once
0007 #endif
0008 
0009 /////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8
0010 // level.hpp:
0011 
0012 // (C) Copyright 2002 Robert Ramey - http://www.rrsd.com .
0013 // Use, modification and distribution is subject to the Boost Software
0014 // License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
0015 // http://www.boost.org/LICENSE_1_0.txt)
0016 
0017 //  See http://www.boost.org for updates, documentation, and revision history.
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 // default serialization implementation level
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     // note: at least one compiler complained w/o the full qualification
0050     // on basic traits below
0051     typedef
0052         typename mpl::eval_if<
0053             is_base_and_derived<boost::serialization::basic_traits, T>,
0054             traits_class_level< T >,
0055         //else
0056         typename mpl::eval_if<
0057             is_fundamental< T >,
0058             mpl::int_<primitive_type>,
0059         //else
0060         typename mpl::eval_if<
0061             is_class< T >,
0062             mpl::int_<object_class_info>,
0063         //else
0064         typename mpl::eval_if<
0065             is_array< T >,
0066                 mpl::int_<object_serializable>,
0067         //else
0068         typename mpl::eval_if<
0069             is_enum< T >,
0070                 mpl::int_<primitive_type>,
0071         //else
0072             mpl::int_<not_serializable>
0073         >
0074         >
0075         >
0076         >
0077         >::type type;
0078         // vc 7.1 doesn't like enums here
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 } // namespace serialization
0095 } // namespace boost
0096 
0097 // specify the level of serialization implementation for the class
0098 // require that class info saved when versioning is used
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 // BOOST_SERIALIZATION_LEVEL_HPP