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) 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 #include <boost/static_assert.hpp> 24 #include <boost/mpl/eval_if.hpp> 25 #include <boost/mpl/identity.hpp> 26 #include <boost/type_traits/is_base_and_derived.hpp> 27 #include <boost/serialization/traits.hpp> 28 29 namespace boost { 30 namespace serialization { 31 32 // note that T and const T are folded into const T so that 33 // there is only one table entry per type 34 template<class T> 35 struct type_info_implementation { 36 template<class U> 37 struct traits_class_typeinfo_implementation { 38 typedef typename U::type_info_implementation::type type; 39 }; 40 // note: at least one compiler complained w/o the full qualification 41 // on basic traits below 42 typedef 43 typename mpl::eval_if< 44 is_base_and_derived<boost::serialization::basic_traits, T>, 45 traits_class_typeinfo_implementation< T >, 46 //else 47 mpl::identity< 48 typename extended_type_info_impl< T >::type 49 > 50 >::type type; 51 }; 52 53 } // namespace serialization 54 } // namespace boost 55 56 // define a macro to assign a particular derivation of extended_type_info 57 // to a specified a class. 58 #define BOOST_CLASS_TYPE_INFO(T, ETI) \ 59 namespace boost { \ 60 namespace serialization { \ 61 template<> \ 62 struct type_info_implementation< T > { \ 63 typedef ETI type; \ 64 }; \ 65 template<> \ 66 struct type_info_implementation< const T > { \ 67 typedef ETI type; \ 68 }; \ 69 } \ 70 } \ 71 /**/ 72 73 #endif /// BOOST_SERIALIZATION_TYPE_INFO_IMPLEMENTATION_HPP 74