1 | #ifndef BOOST_SERIALIZATION_COLLECTION_TRAITS_HPP |
2 | #define BOOST_SERIALIZATION_COLLECTION_TRAITS_HPP |
3 | |
4 | // MS compatible compilers support #pragma once |
5 | #if defined(_MSC_VER) |
6 | # pragma once |
7 | #endif |
8 | |
9 | /////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8 |
10 | // collection_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 assigns a level implemenation trait to a collection type |
20 | // for all primitives. It is needed so that archives which are meant to be |
21 | // portable don't write class information in the archive. Since, not all |
22 | // compiles recognize the same set of primitive types, the possibility |
23 | // exists for archives to be non-portable if class information for primitive |
24 | // types is included. This is addressed by the following macros. |
25 | #include <boost/config.hpp> |
26 | #include <boost/mpl/integral_c.hpp> |
27 | #include <boost/mpl/integral_c_tag.hpp> |
28 | |
29 | #include <boost/cstdint.hpp> |
30 | #include <boost/integer_traits.hpp> |
31 | #include <climits> // ULONG_MAX |
32 | #include <boost/serialization/level.hpp> |
33 | |
34 | #define BOOST_SERIALIZATION_COLLECTION_TRAITS_HELPER(T, C) \ |
35 | template<> \ |
36 | struct implementation_level< C < T > > { \ |
37 | typedef mpl::integral_c_tag tag; \ |
38 | typedef mpl::int_<object_serializable> type; \ |
39 | BOOST_STATIC_CONSTANT(int, value = object_serializable); \ |
40 | }; \ |
41 | /**/ |
42 | |
43 | #if defined(BOOST_NO_CWCHAR) || defined(BOOST_NO_INTRINSIC_WCHAR_T) |
44 | #define BOOST_SERIALIZATION_COLLECTION_TRAITS_HELPER_WCHAR(C) |
45 | #else |
46 | #define BOOST_SERIALIZATION_COLLECTION_TRAITS_HELPER_WCHAR(C) \ |
47 | BOOST_SERIALIZATION_COLLECTION_TRAITS_HELPER(wchar_t, C) \ |
48 | /**/ |
49 | #endif |
50 | |
51 | #if defined(BOOST_HAS_LONG_LONG) |
52 | #define BOOST_SERIALIZATION_COLLECTION_TRAITS_HELPER_INT64(C) \ |
53 | BOOST_SERIALIZATION_COLLECTION_TRAITS_HELPER(boost::long_long_type, C) \ |
54 | BOOST_SERIALIZATION_COLLECTION_TRAITS_HELPER(boost::ulong_long_type, C) \ |
55 | /**/ |
56 | #else |
57 | #define BOOST_SERIALIZATION_COLLECTION_TRAITS_HELPER_INT64(C) |
58 | #endif |
59 | |
60 | #define BOOST_SERIALIZATION_COLLECTION_TRAITS(C) \ |
61 | namespace boost { namespace serialization { \ |
62 | BOOST_SERIALIZATION_COLLECTION_TRAITS_HELPER(bool, C) \ |
63 | BOOST_SERIALIZATION_COLLECTION_TRAITS_HELPER(char, C) \ |
64 | BOOST_SERIALIZATION_COLLECTION_TRAITS_HELPER(signed char, C) \ |
65 | BOOST_SERIALIZATION_COLLECTION_TRAITS_HELPER(unsigned char, C) \ |
66 | BOOST_SERIALIZATION_COLLECTION_TRAITS_HELPER(signed int, C) \ |
67 | BOOST_SERIALIZATION_COLLECTION_TRAITS_HELPER(unsigned int, C) \ |
68 | BOOST_SERIALIZATION_COLLECTION_TRAITS_HELPER(signed long, C) \ |
69 | BOOST_SERIALIZATION_COLLECTION_TRAITS_HELPER(unsigned long, C) \ |
70 | BOOST_SERIALIZATION_COLLECTION_TRAITS_HELPER(float, C) \ |
71 | BOOST_SERIALIZATION_COLLECTION_TRAITS_HELPER(double, C) \ |
72 | BOOST_SERIALIZATION_COLLECTION_TRAITS_HELPER(unsigned short, C) \ |
73 | BOOST_SERIALIZATION_COLLECTION_TRAITS_HELPER(signed short, C) \ |
74 | BOOST_SERIALIZATION_COLLECTION_TRAITS_HELPER_INT64(C) \ |
75 | BOOST_SERIALIZATION_COLLECTION_TRAITS_HELPER_WCHAR(C) \ |
76 | } } \ |
77 | /**/ |
78 | |
79 | #endif // BOOST_SERIALIZATION_COLLECTION_TRAITS |
80 | |