Chris@16
|
1 #ifndef BOOST_SERIALIZATION_TRAITS_HPP
|
Chris@16
|
2 #define BOOST_SERIALIZATION_TRAITS_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 // traits.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 // This header is used to apply serialization traits to templates. The
|
Chris@16
|
20 // standard system can't be used for platforms which don't support
|
Chris@16
|
21 // Partial Templlate Specialization.
|
Chris@16
|
22
|
Chris@16
|
23 // The motivation for this is the Name-Value Pair (NVP) template.
|
Chris@16
|
24 // it has to work the same on all platforms in order for archives
|
Chris@16
|
25 // to be portable accross platforms.
|
Chris@16
|
26
|
Chris@16
|
27 #include <boost/config.hpp>
|
Chris@16
|
28 #include <boost/static_assert.hpp>
|
Chris@16
|
29
|
Chris@16
|
30 #include <boost/mpl/int.hpp>
|
Chris@16
|
31 #include <boost/mpl/bool.hpp>
|
Chris@16
|
32 #include <boost/serialization/level_enum.hpp>
|
Chris@16
|
33 #include <boost/serialization/tracking_enum.hpp>
|
Chris@16
|
34
|
Chris@16
|
35 namespace boost {
|
Chris@16
|
36 namespace serialization {
|
Chris@16
|
37
|
Chris@16
|
38 // common base class used to detect appended traits class
|
Chris@16
|
39 struct basic_traits {};
|
Chris@16
|
40
|
Chris@16
|
41 template <class T>
|
Chris@16
|
42 struct extended_type_info_impl;
|
Chris@16
|
43
|
Chris@16
|
44 template<
|
Chris@16
|
45 class T,
|
Chris@16
|
46 int Level,
|
Chris@16
|
47 int Tracking,
|
Chris@16
|
48 unsigned int Version = 0,
|
Chris@16
|
49 class ETII = extended_type_info_impl< T >,
|
Chris@16
|
50 class Wrapper = mpl::false_
|
Chris@16
|
51 >
|
Chris@16
|
52 struct traits : public basic_traits {
|
Chris@16
|
53 BOOST_STATIC_ASSERT(Version == 0 || Level >= object_class_info);
|
Chris@16
|
54 BOOST_STATIC_ASSERT(Tracking == track_never || Level >= object_serializable);
|
Chris@101
|
55 typedef typename mpl::int_<Level> level;
|
Chris@101
|
56 typedef typename mpl::int_<Tracking> tracking;
|
Chris@101
|
57 typedef typename mpl::int_<Version> version;
|
Chris@16
|
58 typedef ETII type_info_implementation;
|
Chris@16
|
59 typedef Wrapper is_wrapper;
|
Chris@16
|
60 };
|
Chris@16
|
61
|
Chris@16
|
62 } // namespace serialization
|
Chris@16
|
63 } // namespace boost
|
Chris@16
|
64
|
Chris@16
|
65 #endif // BOOST_SERIALIZATION_TRAITS_HPP
|