Chris@16
|
1 #ifndef BOOST_SERIALIZATION_WRAPPER_HPP
|
Chris@16
|
2 #define BOOST_SERIALIZATION_WRAPPER_HPP
|
Chris@16
|
3
|
Chris@16
|
4 // (C) Copyright 2005-2006 Matthias Troyer
|
Chris@16
|
5 // Use, modification and distribution is subject to the Boost Software
|
Chris@16
|
6 // License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
|
Chris@16
|
7 // http://www.boost.org/LICENSE_1_0.txt)
|
Chris@16
|
8
|
Chris@16
|
9 #include <boost/serialization/traits.hpp>
|
Chris@16
|
10 #include <boost/type_traits/is_base_and_derived.hpp>
|
Chris@16
|
11 #include <boost/mpl/eval_if.hpp>
|
Chris@16
|
12 #include <boost/mpl/bool.hpp>
|
Chris@16
|
13
|
Chris@16
|
14 namespace boost { namespace serialization {
|
Chris@16
|
15
|
Chris@16
|
16 /// the base class for serialization wrappers
|
Chris@16
|
17 ///
|
Chris@16
|
18 /// wrappers need to be treated differently at various places in the serialization library,
|
Chris@16
|
19 /// e.g. saving of non-const wrappers has to be possible. Since partial specialization
|
Chris@16
|
20 // is not supported by all compilers, we derive all wrappers from wrapper_traits.
|
Chris@16
|
21
|
Chris@16
|
22 template<
|
Chris@16
|
23 class T,
|
Chris@16
|
24 int Level = object_serializable,
|
Chris@16
|
25 int Tracking = track_never,
|
Chris@16
|
26 unsigned int Version = 0,
|
Chris@16
|
27 class ETII = extended_type_info_impl< T >
|
Chris@16
|
28 >
|
Chris@16
|
29 struct wrapper_traits :
|
Chris@16
|
30 public traits<T,Level,Tracking,Version,ETII,mpl::true_>
|
Chris@16
|
31 {};
|
Chris@16
|
32
|
Chris@16
|
33 template<class T>
|
Chris@16
|
34 struct is_wrapper_impl :
|
Chris@16
|
35 boost::mpl::eval_if<
|
Chris@16
|
36 boost::is_base_and_derived<basic_traits,T>,
|
Chris@16
|
37 boost::mpl::true_,
|
Chris@16
|
38 boost::mpl::false_
|
Chris@16
|
39 >::type
|
Chris@16
|
40 {};
|
Chris@16
|
41
|
Chris@16
|
42 template<class T>
|
Chris@16
|
43 struct is_wrapper {
|
Chris@101
|
44 typedef typename is_wrapper_impl<const T>::type type;
|
Chris@16
|
45 };
|
Chris@16
|
46
|
Chris@16
|
47 } // serialization
|
Chris@16
|
48 } // boost
|
Chris@16
|
49
|
Chris@16
|
50 // A macro to define that a class is a wrapper
|
Chris@16
|
51 #define BOOST_CLASS_IS_WRAPPER(T) \
|
Chris@16
|
52 namespace boost { \
|
Chris@16
|
53 namespace serialization { \
|
Chris@16
|
54 template<> \
|
Chris@16
|
55 struct is_wrapper_impl<const T> : boost::mpl::true_ {}; \
|
Chris@16
|
56 } \
|
Chris@16
|
57 } \
|
Chris@16
|
58 /**/
|
Chris@16
|
59
|
Chris@16
|
60 #endif //BOOST_SERIALIZATION_WRAPPER_HPP
|