1 #ifndef BOOST_SERIALIZATION_LEVEL_HPP
2 #define BOOST_SERIALIZATION_LEVEL_HPP
4 // MS compatible compilers support #pragma once
9 /////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8
12 // (C) Copyright 2002 Robert Ramey - http://www.rrsd.com .
13 // Use, modification and distribution is subject to the Boost Software
14 // License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
15 // http://www.boost.org/LICENSE_1_0.txt)
17 // See http://www.boost.org for updates, documentation, and revision history.
19 #include <boost/config.hpp>
20 #include <boost/detail/workaround.hpp>
22 #include <boost/type_traits/is_fundamental.hpp>
23 #include <boost/type_traits/is_enum.hpp>
24 #include <boost/type_traits/is_array.hpp>
25 #include <boost/type_traits/is_class.hpp>
26 #include <boost/type_traits/is_base_and_derived.hpp>
28 #include <boost/mpl/eval_if.hpp>
29 #include <boost/mpl/int.hpp>
30 #include <boost/mpl/integral_c.hpp>
31 #include <boost/mpl/integral_c_tag.hpp>
33 #include <boost/serialization/level_enum.hpp>
36 namespace serialization {
40 // default serialization implementation level
42 struct implementation_level_impl {
44 struct traits_class_level {
45 typedef typename U::level type;
48 typedef mpl::integral_c_tag tag;
49 // note: at least one compiler complained w/o the full qualification
50 // on basic traits below
52 typename mpl::eval_if<
53 is_base_and_derived<boost::serialization::basic_traits, T>,
54 traits_class_level< T >,
56 typename mpl::eval_if<
58 mpl::int_<primitive_type>,
60 typename mpl::eval_if<
62 mpl::int_<object_class_info>,
64 typename mpl::eval_if<
66 mpl::int_<object_serializable>,
68 typename mpl::eval_if<
70 mpl::int_<primitive_type>,
72 mpl::int_<not_serializable>
78 // vc 7.1 doesn't like enums here
79 BOOST_STATIC_CONSTANT(int, value = type::value);
83 struct implementation_level :
84 public implementation_level_impl<const T>
88 template<class T, int L>
89 inline bool operator>=(implementation_level< T > t, enum level_type l)
91 return t.value >= (int)l;
94 } // namespace serialization
97 // specify the level of serialization implementation for the class
98 // require that class info saved when versioning is used
99 #define BOOST_CLASS_IMPLEMENTATION(T, E) \
101 namespace serialization { \
103 struct implementation_level_impl< const T > \
105 typedef mpl::integral_c_tag tag; \
106 typedef mpl::int_< E > type; \
107 BOOST_STATIC_CONSTANT( \
109 value = implementation_level_impl::type::value \
116 #endif // BOOST_SERIALIZATION_LEVEL_HPP