sl@0
|
1 |
#ifndef BOOST_SERIALIZATION_TRAITS_HPP
|
sl@0
|
2 |
#define BOOST_SERIALIZATION_TRAITS_HPP
|
sl@0
|
3 |
|
sl@0
|
4 |
// MS compatible compilers support #pragma once
|
sl@0
|
5 |
#if defined(_MSC_VER) && (_MSC_VER >= 1020)
|
sl@0
|
6 |
# pragma once
|
sl@0
|
7 |
#endif
|
sl@0
|
8 |
|
sl@0
|
9 |
/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8
|
sl@0
|
10 |
// traits.hpp:
|
sl@0
|
11 |
|
sl@0
|
12 |
// (C) Copyright 2002 Robert Ramey - http://www.rrsd.com .
|
sl@0
|
13 |
// Use, modification and distribution is subject to the Boost Software
|
sl@0
|
14 |
// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
|
sl@0
|
15 |
// http://www.boost.org/LICENSE_1_0.txt)
|
sl@0
|
16 |
|
sl@0
|
17 |
// See http://www.boost.org for updates, documentation, and revision history.
|
sl@0
|
18 |
|
sl@0
|
19 |
// This header is used to apply serialization traits to templates. The
|
sl@0
|
20 |
// standard system can't be used for platforms which don't support
|
sl@0
|
21 |
// Partial Templlate Specialization.
|
sl@0
|
22 |
|
sl@0
|
23 |
// The motivation for this is the Name-Value Pair (NVP) template.
|
sl@0
|
24 |
// it has to work the same on all platforms in order for archives
|
sl@0
|
25 |
// to be portable accross platforms.
|
sl@0
|
26 |
|
sl@0
|
27 |
#include <boost/config.hpp>
|
sl@0
|
28 |
#include <boost/static_assert.hpp>
|
sl@0
|
29 |
|
sl@0
|
30 |
#include <boost/mpl/int.hpp>
|
sl@0
|
31 |
#include <boost/serialization/level_enum.hpp>
|
sl@0
|
32 |
#include <boost/serialization/tracking_enum.hpp>
|
sl@0
|
33 |
|
sl@0
|
34 |
namespace boost {
|
sl@0
|
35 |
namespace serialization {
|
sl@0
|
36 |
|
sl@0
|
37 |
// common base class used to detect appended traits class
|
sl@0
|
38 |
struct basic_traits {};
|
sl@0
|
39 |
|
sl@0
|
40 |
template <class T>
|
sl@0
|
41 |
struct extended_type_info_impl;
|
sl@0
|
42 |
|
sl@0
|
43 |
template<
|
sl@0
|
44 |
class T,
|
sl@0
|
45 |
int Level,
|
sl@0
|
46 |
int Tracking,
|
sl@0
|
47 |
unsigned int Version = 0,
|
sl@0
|
48 |
class ETII = extended_type_info_impl< T >
|
sl@0
|
49 |
>
|
sl@0
|
50 |
struct traits : public basic_traits {
|
sl@0
|
51 |
BOOST_STATIC_ASSERT(Version == 0 || Level >= object_class_info);
|
sl@0
|
52 |
BOOST_STATIC_ASSERT(Tracking == track_never || Level >= object_serializable);
|
sl@0
|
53 |
typedef BOOST_DEDUCED_TYPENAME mpl::int_<Level> level;
|
sl@0
|
54 |
typedef BOOST_DEDUCED_TYPENAME mpl::int_<Tracking> tracking;
|
sl@0
|
55 |
typedef BOOST_DEDUCED_TYPENAME mpl::int_<Version> version;
|
sl@0
|
56 |
typedef ETII type_info_implementation;
|
sl@0
|
57 |
};
|
sl@0
|
58 |
|
sl@0
|
59 |
} // namespace serialization
|
sl@0
|
60 |
} // namespace boost
|
sl@0
|
61 |
|
sl@0
|
62 |
#endif // BOOST_SERIALIZATION_TRAITS_HPP
|