[857] | 1 | #ifndef BOOST_SERIALIZATION_TYPE_INFO_IMPLEMENTATION_HPP
|
---|
| 2 | #define BOOST_SERIALIZATION_TYPE_INFO_IMPLEMENTATION_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 | // type_info_implementation.hpp: interface for portable version of type_info
|
---|
| 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 |
|
---|
| 20 | #include <boost/config.hpp>
|
---|
| 21 | #include <boost/detail/workaround.hpp>
|
---|
| 22 |
|
---|
| 23 | namespace boost {
|
---|
| 24 | namespace serialization {
|
---|
| 25 | template<class T>
|
---|
| 26 | class extended_type_info_null;
|
---|
| 27 | struct basic_traits;
|
---|
| 28 | } // namespace serialization
|
---|
| 29 | } // namespace boost
|
---|
| 30 |
|
---|
| 31 |
|
---|
| 32 | #ifdef BOOST_SERIALIZATION_DEFAULT_TYPE_INFO
|
---|
| 33 | #define BOOST_SERIALIZATION_EXTENDED_TYPE_INFO_STUB(T) \
|
---|
| 34 | BOOST_SERIALIZATION_DEFAULT_TYPE_INFO(T)
|
---|
| 35 | #else
|
---|
| 36 | #define BOOST_SERIALIZATION_EXTENDED_TYPE_INFO_STUB(T) \
|
---|
| 37 | extended_type_info_null< T >
|
---|
| 38 | #endif
|
---|
| 39 |
|
---|
| 40 | #include <boost/static_assert.hpp>
|
---|
| 41 | #include <boost/mpl/eval_if.hpp>
|
---|
| 42 | #include <boost/mpl/identity.hpp>
|
---|
| 43 | #include <boost/type_traits/is_base_and_derived.hpp>
|
---|
| 44 | #include <boost/serialization/traits.hpp>
|
---|
| 45 |
|
---|
| 46 | namespace boost {
|
---|
| 47 | namespace serialization {
|
---|
| 48 |
|
---|
| 49 | // note that T and const T are folded into const T so that
|
---|
| 50 | // there is only one table entry per type
|
---|
| 51 | template<class T>
|
---|
| 52 | struct type_info_implementation {
|
---|
| 53 | template<class U>
|
---|
| 54 | struct traits_class_typeinfo_implementation {
|
---|
| 55 | typedef BOOST_DEDUCED_TYPENAME U::type_info_implementation type;
|
---|
| 56 | };
|
---|
| 57 | typedef
|
---|
| 58 | BOOST_DEDUCED_TYPENAME mpl::eval_if<
|
---|
| 59 | boost::is_base_and_derived<basic_traits, T>,
|
---|
| 60 | traits_class_typeinfo_implementation<T>,
|
---|
| 61 | //else
|
---|
| 62 | mpl::identity<
|
---|
| 63 | BOOST_SERIALIZATION_EXTENDED_TYPE_INFO_STUB(T)
|
---|
| 64 | >
|
---|
| 65 | >::type type;
|
---|
| 66 | };
|
---|
| 67 |
|
---|
| 68 | } // namespace serialization
|
---|
| 69 | } // namespace boost
|
---|
| 70 |
|
---|
| 71 | // define a macro to assign a particular derivation of extended_type_info
|
---|
| 72 | // to a specified a class.
|
---|
| 73 | #if BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x560))
|
---|
| 74 | #define BOOST_CLASS_TYPE_INFO(T, ETI) \
|
---|
| 75 | namespace boost { \
|
---|
| 76 | namespace serialization { \
|
---|
| 77 | template<> \
|
---|
| 78 | struct type_info_implementation< T > { \
|
---|
| 79 | typedef ETI type; \
|
---|
| 80 | }; \
|
---|
| 81 | } \
|
---|
| 82 | } \
|
---|
| 83 | /**/
|
---|
| 84 | #else
|
---|
| 85 | #define BOOST_CLASS_TYPE_INFO(T, ETI) \
|
---|
| 86 | namespace boost { \
|
---|
| 87 | namespace serialization { \
|
---|
| 88 | template<> \
|
---|
| 89 | struct type_info_implementation< T > { \
|
---|
| 90 | typedef ETI type; \
|
---|
| 91 | }; \
|
---|
| 92 | template<> \
|
---|
| 93 | struct type_info_implementation< const T > { \
|
---|
| 94 | typedef ETI type; \
|
---|
| 95 | }; \
|
---|
| 96 | } \
|
---|
| 97 | } \
|
---|
| 98 | /**/
|
---|
| 99 | #endif
|
---|
| 100 |
|
---|
| 101 | #endif /// BOOST_SERIALIZATION_TYPE_INFO_IMPLEMENTATION_HPP
|
---|