Jeff Thompson | a28eed8 | 2013-08-22 16:21:10 -0700 | [diff] [blame] | 1 | |
| 2 | // (C) Copyright Tobias Schwinger |
| 3 | // |
| 4 | // Use modification and distribution are subject to the boost Software License, |
| 5 | // Version 1.0. (See http://www.boost.org/LICENSE_1_0.txt). |
| 6 | |
| 7 | //------------------------------------------------------------------------------ |
| 8 | |
| 9 | // no include guards, this file is guarded externally |
| 10 | |
| 11 | #ifdef __WAVE__ |
| 12 | // this file has been generated from the master.hpp file in the same directory |
| 13 | # pragma wave option(preserve: 0) |
| 14 | #endif |
| 15 | |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame^] | 16 | #if !defined(NDNBOOST_FT_PREPROCESSING_MODE) || defined(NDNBOOST_FT_CONFIG_HPP_INCLUDED) |
Jeff Thompson | a28eed8 | 2013-08-22 16:21:10 -0700 | [diff] [blame] | 17 | # error "this file used with two-pass preprocessing, only" |
| 18 | #endif |
| 19 | |
| 20 | #include <ndnboost/preprocessor/slot/slot.hpp> |
| 21 | #include <ndnboost/function_types/detail/encoding/def.hpp> |
| 22 | |
| 23 | namespace ndnboost { namespace function_types { |
| 24 | |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame^] | 25 | typedef detail::property_tag<NDNBOOST_FT_non_variadic,NDNBOOST_FT_variadic_mask> non_variadic; |
| 26 | typedef detail::property_tag<NDNBOOST_FT_variadic,NDNBOOST_FT_variadic_mask> variadic; |
Jeff Thompson | a28eed8 | 2013-08-22 16:21:10 -0700 | [diff] [blame] | 27 | |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame^] | 28 | typedef detail::property_tag<0,NDNBOOST_FT_const> non_const; |
| 29 | typedef detail::property_tag<NDNBOOST_FT_const,NDNBOOST_FT_const> const_qualified; |
Jeff Thompson | a28eed8 | 2013-08-22 16:21:10 -0700 | [diff] [blame] | 30 | |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame^] | 31 | typedef detail::property_tag<0,NDNBOOST_FT_volatile> non_volatile; |
| 32 | typedef detail::property_tag<NDNBOOST_FT_volatile,NDNBOOST_FT_volatile> volatile_qualified; |
Jeff Thompson | a28eed8 | 2013-08-22 16:21:10 -0700 | [diff] [blame] | 33 | |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame^] | 34 | typedef detail::property_tag<NDNBOOST_FT_default_cc,NDNBOOST_FT_cc_mask> default_cc; |
Jeff Thompson | a28eed8 | 2013-08-22 16:21:10 -0700 | [diff] [blame] | 35 | |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame^] | 36 | #define NDNBOOST_PP_VALUE NDNBOOST_FT_const|NDNBOOST_FT_volatile |
| 37 | #include NDNBOOST_PP_ASSIGN_SLOT(1) |
Jeff Thompson | a28eed8 | 2013-08-22 16:21:10 -0700 | [diff] [blame] | 38 | |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame^] | 39 | typedef detail::property_tag<0 , NDNBOOST_PP_SLOT(1)> non_cv; |
| 40 | typedef detail::property_tag<NDNBOOST_FT_const , NDNBOOST_PP_SLOT(1)> const_non_volatile; |
| 41 | typedef detail::property_tag<NDNBOOST_FT_volatile, NDNBOOST_PP_SLOT(1)> volatile_non_const; |
| 42 | typedef detail::property_tag<NDNBOOST_PP_SLOT(1) , NDNBOOST_PP_SLOT(1)> cv_qualified; |
Jeff Thompson | a28eed8 | 2013-08-22 16:21:10 -0700 | [diff] [blame] | 43 | |
| 44 | namespace detail { |
| 45 | |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame^] | 46 | typedef constant<NDNBOOST_FT_full_mask> full_mask; |
Jeff Thompson | a28eed8 | 2013-08-22 16:21:10 -0700 | [diff] [blame] | 47 | |
| 48 | template <bits_t Flags, bits_t CCID> struct encode_bits_impl |
| 49 | { |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame^] | 50 | NDNBOOST_STATIC_CONSTANT( bits_t, value = |
| 51 | Flags | (NDNBOOST_FT_default_cc * CCID) << 1 ); |
Jeff Thompson | a28eed8 | 2013-08-22 16:21:10 -0700 | [diff] [blame] | 52 | }; |
| 53 | |
| 54 | template <bits_t Flags, bits_t CCID, std::size_t Arity> |
| 55 | struct encode_charr_impl |
| 56 | { |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame^] | 57 | NDNBOOST_STATIC_CONSTANT(std::size_t, value = (std::size_t)(1+ |
| 58 | Flags | (NDNBOOST_FT_default_cc * CCID) << 1 | Arity << NDNBOOST_FT_arity_shift |
Jeff Thompson | a28eed8 | 2013-08-22 16:21:10 -0700 | [diff] [blame] | 59 | )); |
| 60 | }; |
| 61 | |
| 62 | template <bits_t Bits> struct decode_bits |
| 63 | { |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame^] | 64 | NDNBOOST_STATIC_CONSTANT(bits_t, flags = Bits & NDNBOOST_FT_flags_mask); |
Jeff Thompson | a28eed8 | 2013-08-22 16:21:10 -0700 | [diff] [blame] | 65 | |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame^] | 66 | NDNBOOST_STATIC_CONSTANT(bits_t, cc_id = |
| 67 | ( (Bits & NDNBOOST_FT_full_mask) / NDNBOOST_FT_default_cc) >> 1 |
Jeff Thompson | a28eed8 | 2013-08-22 16:21:10 -0700 | [diff] [blame] | 68 | ); |
| 69 | |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame^] | 70 | NDNBOOST_STATIC_CONSTANT(bits_t, tag_bits = (Bits & NDNBOOST_FT_full_mask)); |
Jeff Thompson | a28eed8 | 2013-08-22 16:21:10 -0700 | [diff] [blame] | 71 | |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame^] | 72 | NDNBOOST_STATIC_CONSTANT(std::size_t, arity = (std::size_t) |
| 73 | (Bits >> NDNBOOST_FT_arity_shift) |
Jeff Thompson | a28eed8 | 2013-08-22 16:21:10 -0700 | [diff] [blame] | 74 | ); |
| 75 | }; |
| 76 | |
| 77 | template <bits_t LHS_bits, bits_t LHS_mask, bits_t RHS_bits, bits_t RHS_mask> |
| 78 | struct tag_ice |
| 79 | { |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame^] | 80 | NDNBOOST_STATIC_CONSTANT(bool, match = |
| 81 | RHS_bits == (LHS_bits & RHS_mask & (RHS_bits |~NDNBOOST_FT_type_mask)) |
Jeff Thompson | a28eed8 | 2013-08-22 16:21:10 -0700 | [diff] [blame] | 82 | ); |
| 83 | |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame^] | 84 | NDNBOOST_STATIC_CONSTANT(bits_t, combined_bits = |
Jeff Thompson | a28eed8 | 2013-08-22 16:21:10 -0700 | [diff] [blame] | 85 | (LHS_bits & ~RHS_mask) | RHS_bits |
| 86 | ); |
| 87 | |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame^] | 88 | NDNBOOST_STATIC_CONSTANT(bits_t, combined_mask = |
Jeff Thompson | a28eed8 | 2013-08-22 16:21:10 -0700 | [diff] [blame] | 89 | LHS_mask | RHS_mask |
| 90 | ); |
| 91 | |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame^] | 92 | NDNBOOST_STATIC_CONSTANT(bits_t, extracted_bits = |
Jeff Thompson | a28eed8 | 2013-08-22 16:21:10 -0700 | [diff] [blame] | 93 | LHS_bits & RHS_mask |
| 94 | ); |
| 95 | |
| 96 | }; |
| 97 | |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame^] | 98 | #define NDNBOOST_FT_mask NDNBOOST_FT_type_mask |
| 99 | typedef property_tag<NDNBOOST_FT_callable_builtin,NDNBOOST_FT_mask> callable_builtin_tag; |
| 100 | typedef property_tag<NDNBOOST_FT_non_member_callable_builtin,NDNBOOST_FT_mask> nonmember_callable_builtin_tag; |
| 101 | typedef property_tag<NDNBOOST_FT_function,NDNBOOST_FT_mask> function_tag; |
| 102 | typedef property_tag<NDNBOOST_FT_reference,NDNBOOST_FT_mask> reference_tag; |
| 103 | typedef property_tag<NDNBOOST_FT_pointer,NDNBOOST_FT_mask> pointer_tag; |
| 104 | typedef property_tag<NDNBOOST_FT_member_function_pointer,NDNBOOST_FT_mask> member_function_pointer_tag; |
| 105 | typedef property_tag<NDNBOOST_FT_member_object_pointer,NDNBOOST_FT_mask> member_object_pointer_tag; |
| 106 | typedef property_tag<NDNBOOST_FT_member_object_pointer_flags,NDNBOOST_FT_full_mask> member_object_pointer_base; |
| 107 | typedef property_tag<NDNBOOST_FT_member_pointer,NDNBOOST_FT_mask> member_pointer_tag; |
| 108 | #undef NDNBOOST_FT_mask |
Jeff Thompson | a28eed8 | 2013-08-22 16:21:10 -0700 | [diff] [blame] | 109 | |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame^] | 110 | #define NDNBOOST_PP_VALUE NDNBOOST_FT_function|NDNBOOST_FT_non_variadic|NDNBOOST_FT_default_cc |
| 111 | #include NDNBOOST_PP_ASSIGN_SLOT(1) |
| 112 | #define NDNBOOST_PP_VALUE NDNBOOST_FT_type_mask|NDNBOOST_FT_variadic_mask|NDNBOOST_FT_cc_mask |
| 113 | #include NDNBOOST_PP_ASSIGN_SLOT(2) |
Jeff Thompson | a28eed8 | 2013-08-22 16:21:10 -0700 | [diff] [blame] | 114 | |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame^] | 115 | typedef property_tag< NDNBOOST_PP_SLOT(1) , NDNBOOST_PP_SLOT(2) > nv_dcc_func; |
Jeff Thompson | a28eed8 | 2013-08-22 16:21:10 -0700 | [diff] [blame] | 116 | |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame^] | 117 | #define NDNBOOST_PP_VALUE \ |
| 118 | NDNBOOST_FT_member_function_pointer|NDNBOOST_FT_non_variadic|NDNBOOST_FT_default_cc |
| 119 | #include NDNBOOST_PP_ASSIGN_SLOT(1) |
Jeff Thompson | a28eed8 | 2013-08-22 16:21:10 -0700 | [diff] [blame] | 120 | |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame^] | 121 | typedef property_tag< NDNBOOST_PP_SLOT(1) , NDNBOOST_PP_SLOT(2) > nv_dcc_mfp; |
Jeff Thompson | a28eed8 | 2013-08-22 16:21:10 -0700 | [diff] [blame] | 122 | |
| 123 | } // namespace detail |
| 124 | |
| 125 | } } // namespace ::ndnboost::function_types |
| 126 | |