[857] | 1 | #ifndef BOOST_SERIALIZATION_VERSION_HPP
|
---|
| 2 | #define BOOST_SERIALIZATION_VERSION_HPP
|
---|
| 3 |
|
---|
| 4 | // MS compatible compilers support #pragma once
|
---|
| 5 | #if defined(_MSC_VER) && (_MSC_VER >= 1020)
|
---|
| 6 | # pragma once
|
---|
| 7 | #endif
|
---|
| 8 |
|
---|
| 9 | /////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8
|
---|
| 10 | // version.hpp:
|
---|
| 11 |
|
---|
| 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)
|
---|
| 16 |
|
---|
| 17 | // See http://www.boost.org for updates, documentation, and revision history.
|
---|
| 18 |
|
---|
| 19 | #include <boost/config.hpp>
|
---|
| 20 | #include <boost/mpl/int.hpp>
|
---|
| 21 | #include <boost/mpl/eval_if.hpp>
|
---|
| 22 | #include <boost/mpl/identity.hpp>
|
---|
| 23 | #include <boost/mpl/integral_c_tag.hpp>
|
---|
| 24 |
|
---|
| 25 | #include <boost/serialization/traits.hpp>
|
---|
| 26 | #include <boost/type_traits/is_base_and_derived.hpp>
|
---|
| 27 |
|
---|
| 28 | namespace boost {
|
---|
| 29 | namespace serialization {
|
---|
| 30 |
|
---|
| 31 | // default version number is 0. Override with higher version
|
---|
| 32 | // when class definition changes.
|
---|
| 33 | template<class T>
|
---|
| 34 | struct version
|
---|
| 35 | {
|
---|
| 36 | template<class U>
|
---|
| 37 | struct traits_class_version {
|
---|
| 38 | typedef BOOST_DEDUCED_TYPENAME U::version type;
|
---|
| 39 | };
|
---|
| 40 |
|
---|
| 41 | typedef mpl::integral_c_tag tag;
|
---|
| 42 | typedef
|
---|
| 43 | BOOST_DEDUCED_TYPENAME mpl::eval_if<
|
---|
| 44 | is_base_and_derived<basic_traits,T>,
|
---|
| 45 | traits_class_version<T>,
|
---|
| 46 | mpl::int_<0>
|
---|
| 47 | >::type type;
|
---|
| 48 | BOOST_STATIC_CONSTANT(unsigned int, value = version::type::value);
|
---|
| 49 | };
|
---|
| 50 |
|
---|
| 51 | } // namespace serialization
|
---|
| 52 | } // namespace boost
|
---|
| 53 |
|
---|
| 54 | // specify the current version number for the class
|
---|
| 55 | #define BOOST_CLASS_VERSION(T, N) \
|
---|
| 56 | namespace boost { \
|
---|
| 57 | namespace serialization { \
|
---|
| 58 | template<> \
|
---|
| 59 | struct version<T > \
|
---|
| 60 | { \
|
---|
| 61 | typedef mpl::int_<N> type; \
|
---|
| 62 | typedef mpl::integral_c_tag tag; \
|
---|
| 63 | BOOST_STATIC_CONSTANT(unsigned int, value = version::type::value); \
|
---|
| 64 | /* require that class info saved when versioning is used */ \
|
---|
| 65 | /* \
|
---|
| 66 | BOOST_STATIC_ASSERT(( \
|
---|
| 67 | mpl::or_< \
|
---|
| 68 | mpl::equal_to< \
|
---|
| 69 | mpl::int_<0>, \
|
---|
| 70 | mpl::int_<N> \
|
---|
| 71 | >, \
|
---|
| 72 | mpl::equal_to< \
|
---|
| 73 | implementation_level<T>, \
|
---|
| 74 | mpl::int_<object_class_info> \
|
---|
| 75 | > \
|
---|
| 76 | >::value \
|
---|
| 77 | )); \
|
---|
| 78 | */ \
|
---|
| 79 | }; \
|
---|
| 80 | } \
|
---|
| 81 | }
|
---|
| 82 |
|
---|
| 83 | #endif // BOOST_SERIALIZATION_VERSION_HPP
|
---|