1 //  Copyright (c) 2015 Anton Bikineev
2 //
3 //  Distributed under the Boost Software License, Version 1.0.
4 //  See accompanying file LICENSE_1_0.txt or copy at
5 //  http://www.boost.org/LICENSE_1_0.txt)
6 
7 #ifndef HPX_TRAITS_POLYMORPHIC_TRAITS_HPP
8 #define HPX_TRAITS_POLYMORPHIC_TRAITS_HPP
9 
10 #include <hpx/traits/has_member_xxx.hpp>
11 #include <hpx/traits/has_xxx.hpp>
12 #include <hpx/util/detail/pp/strip_parens.hpp>
13 
14 #include <type_traits>
15 
16 namespace hpx { namespace traits
17 {
18     namespace detail
19     {
20         HPX_HAS_XXX_TRAIT_DEF(serialized_with_id);
21         HPX_HAS_MEMBER_XXX_TRAIT_DEF(hpx_serialization_get_name)
22     } // namespace detail
23 
24     template <typename T>
25     struct is_intrusive_polymorphic
26       : detail::has_hpx_serialization_get_name<T> {};
27 
28     template <typename T>
29     struct is_nonintrusive_polymorphic
30       : std::false_type {};
31 
32     template <typename T>
33     struct is_serialized_with_id
34       : detail::has_serialized_with_id<T> {};
35 }}
36 
37 #define HPX_TRAITS_NONINTRUSIVE_POLYMORPHIC(Class)                            \
38     namespace hpx { namespace traits {                                        \
39         template <>                                                           \
40         struct is_nonintrusive_polymorphic<Class>                             \
41           : std::true_type {};                                                \
42     }}                                                                        \
43 /**/
44 
45 #define HPX_TRAITS_NONINTRUSIVE_POLYMORPHIC_TEMPLATE(TEMPLATE, ARG_LIST)      \
46     namespace hpx { namespace traits {                                        \
47         HPX_PP_STRIP_PARENS(TEMPLATE)                                         \
48         struct is_nonintrusive_polymorphic<HPX_PP_STRIP_PARENS(ARG_LIST)>     \
49           : std::true_type {};                                                \
50     }}                                                                        \
51 /**/
52 
53 #define HPX_TRAITS_SERIALIZED_WITH_ID(Class)                                  \
54     namespace hpx { namespace traits {                                        \
55         template <>                                                           \
56         struct is_serialized_with_id<Class>                                   \
57           : std::true_type {};                                                \
58     }}                                                                        \
59 /**/
60 
61 #define HPX_TRAITS_SERIALIZED_WITH_ID_TEMPLATE(TEMPLATE, ARG_LIST)            \
62     namespace hpx { namespace traits {                                        \
63         HPX_PP_STRIP_PARENS(TEMPLATE)                                         \
64         struct is_serialized_with_id<HPX_PP_STRIP_PARENS(ARG_LIST)>           \
65           : std::true_type {};                                                \
66     }}                                                                        \
67 /**/
68 
69 #endif
70