serialization/version.hpp
Go to the documentation of this file.
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)
6 # pragma once
7 #endif
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/assert.hpp>
21 #include <boost/mpl/int.hpp>
22 #include <boost/mpl/eval_if.hpp>
23 #include <boost/mpl/identity.hpp>
25 
27 
28 namespace boost {
29 namespace serialization {
30 
31 struct basic_traits;
32 
33 // default version number is 0. Override with higher version
34 // when class definition changes.
35 template<class T>
36 struct version
37 {
38  template<class U>
40  typedef typename U::version type;
41  };
42 
43  typedef mpl::integral_c_tag tag;
44  // note: at least one compiler complained w/o the full qualification
45  // on basic traits below
46  typedef
47  typename mpl::eval_if<
50  mpl::int_<0>
52  BOOST_STATIC_CONSTANT(int, value = version::type::value);
53 };
54 
55 #ifndef BOOST_NO_INCLASS_MEMBER_INITIALIZATION
56 template<class T>
57 const int version<T>::value;
58 #endif
59 
60 } // namespace serialization
61 } // namespace boost
62 
63 /* note: at first it seemed that this would be a good place to trap
64  * as an error an attempt to set a version # for a class which doesn't
65  * save its class information (including version #) in the archive.
66  * However, this imposes a requirement that the version be set after
67  * the implemention level which would be pretty confusing. If this
68  * is to be done, do this check in the input or output operators when
69  * ALL the serialization traits are available. Included the implementation
70  * here with this comment as a reminder not to do this!
71  */
72 //#include <boost/serialization/level.hpp>
73 //#include <boost/mpl/equal_to.hpp>
74 
75 #include <boost/mpl/less.hpp>
76 #include <boost/mpl/comparison.hpp>
77 
78 // specify the current version number for the class
79 // version numbers limited to 8 bits !!!
80 #define BOOST_CLASS_VERSION(T, N) \
81 namespace boost { \
82 namespace serialization { \
83 template<> \
84 struct version<T > \
85 { \
86  typedef mpl::int_<N> type; \
87  typedef mpl::integral_c_tag tag; \
88  BOOST_STATIC_CONSTANT(int, value = version::type::value); \
89  BOOST_MPL_ASSERT(( \
90  boost::mpl::less< \
91  boost::mpl::int_<N>, \
92  boost::mpl::int_<256> \
93  > \
94  )); \
95  /* \
96  BOOST_MPL_ASSERT(( \
97  mpl::equal_to< \
98  :implementation_level<T >, \
99  mpl::int_<object_class_info> \
100  >::value \
101  )); \
102  */ \
103 }; \
104 } \
105 }
106 
107 #endif // BOOST_SERIALIZATION_VERSION_HPP
boost::serialization::version::traits_class_version
Definition: serialization/version.hpp:39
less.hpp
boost::serialization::version::tag
mpl::integral_c_tag tag
Definition: serialization/version.hpp:43
identity.hpp
config.hpp
boost::serialization::version::type
mpl::eval_if< is_base_and_derived< boost::serialization::basic_traits, T >, traits_class_version< T >, mpl::int_< 0 > >::type type
Definition: serialization/version.hpp:51
int.hpp
boost
BOOST_MOVE_USE_STANDARD_LIBRARY_MOVE.
boost::serialization::version
Definition: serialization/version.hpp:36
boost::is_base_and_derived
Definition: is_base_and_derived.hpp:231
assert.hpp
eval_if.hpp
integral_c_tag.hpp
boost::mpl::eval_if
Definition: gcc/basic_bind.hpp:408
is_base_and_derived.hpp
boost::serialization::version::BOOST_STATIC_CONSTANT
BOOST_STATIC_CONSTANT(int, value=version::type::value)
comparison.hpp
boost::serialization::version::traits_class_version::type
U::version type
Definition: serialization/version.hpp:40


sick_visionary_ros
Author(s): SICK AG TechSupport 3D Snapshot
autogenerated on Thu Feb 8 2024 03:56:19