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