annotate DEPENDENCIES/generic/include/boost/serialization/version.hpp @ 125:34e428693f5d vext

Vext -> Repoint
author Chris Cannam
date Thu, 14 Jun 2018 11:15:39 +0100
parents c530137014c0
children
rev   line source
Chris@16 1 #ifndef BOOST_SERIALIZATION_VERSION_HPP
Chris@16 2 #define BOOST_SERIALIZATION_VERSION_HPP
Chris@16 3
Chris@16 4 // MS compatible compilers support #pragma once
Chris@101 5 #if defined(_MSC_VER)
Chris@16 6 # pragma once
Chris@16 7 #endif
Chris@16 8
Chris@16 9 /////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8
Chris@16 10 // version.hpp:
Chris@16 11
Chris@16 12 // (C) Copyright 2002 Robert Ramey - http://www.rrsd.com .
Chris@16 13 // Use, modification and distribution is subject to the Boost Software
Chris@16 14 // License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
Chris@16 15 // http://www.boost.org/LICENSE_1_0.txt)
Chris@16 16
Chris@16 17 // See http://www.boost.org for updates, documentation, and revision history.
Chris@16 18
Chris@16 19 #include <boost/config.hpp>
Chris@16 20 #include <boost/mpl/assert.hpp>
Chris@16 21 #include <boost/mpl/int.hpp>
Chris@16 22 #include <boost/mpl/eval_if.hpp>
Chris@16 23 #include <boost/mpl/identity.hpp>
Chris@16 24 #include <boost/mpl/integral_c_tag.hpp>
Chris@16 25
Chris@16 26 #include <boost/type_traits/is_base_and_derived.hpp>
Chris@16 27
Chris@16 28 namespace boost {
Chris@16 29 namespace serialization {
Chris@16 30
Chris@16 31 struct basic_traits;
Chris@16 32
Chris@16 33 // default version number is 0. Override with higher version
Chris@16 34 // when class definition changes.
Chris@16 35 template<class T>
Chris@16 36 struct version
Chris@16 37 {
Chris@16 38 template<class U>
Chris@16 39 struct traits_class_version {
Chris@101 40 typedef typename U::version type;
Chris@16 41 };
Chris@16 42
Chris@16 43 typedef mpl::integral_c_tag tag;
Chris@16 44 // note: at least one compiler complained w/o the full qualification
Chris@16 45 // on basic traits below
Chris@16 46 typedef
Chris@101 47 typename mpl::eval_if<
Chris@16 48 is_base_and_derived<boost::serialization::basic_traits,T>,
Chris@16 49 traits_class_version< T >,
Chris@16 50 mpl::int_<0>
Chris@16 51 >::type type;
Chris@16 52 BOOST_STATIC_CONSTANT(int, value = version::type::value);
Chris@16 53 };
Chris@16 54
Chris@16 55 #ifndef BOOST_NO_INCLASS_MEMBER_INITIALIZATION
Chris@16 56 template<class T>
Chris@16 57 const int version<T>::value;
Chris@16 58 #endif
Chris@16 59
Chris@16 60 } // namespace serialization
Chris@16 61 } // namespace boost
Chris@16 62
Chris@16 63 /* note: at first it seemed that this would be a good place to trap
Chris@16 64 * as an error an attempt to set a version # for a class which doesn't
Chris@16 65 * save its class information (including version #) in the archive.
Chris@16 66 * However, this imposes a requirement that the version be set after
Chris@16 67 * the implemention level which would be pretty confusing. If this
Chris@16 68 * is to be done, do this check in the input or output operators when
Chris@16 69 * ALL the serialization traits are available. Included the implementation
Chris@16 70 * here with this comment as a reminder not to do this!
Chris@16 71 */
Chris@16 72 //#include <boost/serialization/level.hpp>
Chris@16 73 //#include <boost/mpl/equal_to.hpp>
Chris@16 74
Chris@16 75 #include <boost/mpl/less.hpp>
Chris@16 76 #include <boost/mpl/comparison.hpp>
Chris@16 77
Chris@16 78 // specify the current version number for the class
Chris@16 79 // version numbers limited to 8 bits !!!
Chris@16 80 #define BOOST_CLASS_VERSION(T, N) \
Chris@16 81 namespace boost { \
Chris@16 82 namespace serialization { \
Chris@16 83 template<> \
Chris@16 84 struct version<T > \
Chris@16 85 { \
Chris@16 86 typedef mpl::int_<N> type; \
Chris@16 87 typedef mpl::integral_c_tag tag; \
Chris@16 88 BOOST_STATIC_CONSTANT(int, value = version::type::value); \
Chris@16 89 BOOST_MPL_ASSERT(( \
Chris@16 90 boost::mpl::less< \
Chris@16 91 boost::mpl::int_<N>, \
Chris@16 92 boost::mpl::int_<256> \
Chris@16 93 > \
Chris@16 94 )); \
Chris@16 95 /* \
Chris@16 96 BOOST_MPL_ASSERT(( \
Chris@16 97 mpl::equal_to< \
Chris@16 98 :implementation_level<T >, \
Chris@16 99 mpl::int_<object_class_info> \
Chris@16 100 >::value \
Chris@16 101 )); \
Chris@16 102 */ \
Chris@16 103 }; \
Chris@16 104 } \
Chris@16 105 }
Chris@16 106
Chris@16 107 #endif // BOOST_SERIALIZATION_VERSION_HPP