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 intended for multiple inclusion |
| 10 | |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame] | 11 | #if NDNBOOST_FT_ARITY_LOOP_PREFIX |
Jeff Thompson | a28eed8 | 2013-08-22 16:21:10 -0700 | [diff] [blame] | 12 | |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame] | 13 | # ifndef NDNBOOST_FT_DETAIL_SYNTHESIZE_IMPL_MASTER_HPP_INCLUDED |
| 14 | # define NDNBOOST_FT_DETAIL_SYNTHESIZE_IMPL_MASTER_HPP_INCLUDED |
Jeff Thompson | a28eed8 | 2013-08-22 16:21:10 -0700 | [diff] [blame] | 15 | # include <ndnboost/preprocessor/cat.hpp> |
| 16 | # include <ndnboost/preprocessor/arithmetic/dec.hpp> |
| 17 | # include <ndnboost/preprocessor/iteration/local.hpp> |
| 18 | # include <ndnboost/preprocessor/facilities/empty.hpp> |
| 19 | # include <ndnboost/preprocessor/facilities/identity.hpp> |
| 20 | # endif |
| 21 | |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame] | 22 | # define NDNBOOST_FT_type_name type |
Jeff Thompson | a28eed8 | 2013-08-22 16:21:10 -0700 | [diff] [blame] | 23 | |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame] | 24 | # ifdef NDNBOOST_FT_flags |
| 25 | # define NDNBOOST_FT_make_type(flags,cc,arity) NDNBOOST_FT_make_type_impl(flags,cc,arity) |
| 26 | # define NDNBOOST_FT_make_type_impl(flags,cc,arity) make_type_ ## flags ## _ ## cc ## _ ## arity |
Jeff Thompson | a28eed8 | 2013-08-22 16:21:10 -0700 | [diff] [blame] | 27 | # else |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame] | 28 | NDNBOOST_PP_EXPAND(#) define NDNBOOST_FT_make_type(flags,cc,arity) NDNBOOST_FT_make_type_impl(flags,cc,arity) |
| 29 | NDNBOOST_PP_EXPAND(#) define NDNBOOST_FT_make_type_impl(flags,cc,arity) make_type_ ## flags ## _ ## cc ## _ ## arity |
Jeff Thompson | a28eed8 | 2013-08-22 16:21:10 -0700 | [diff] [blame] | 30 | # endif |
| 31 | |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame] | 32 | # define NDNBOOST_FT_iter(i) NDNBOOST_PP_CAT(iter_,i) |
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 | #elif NDNBOOST_FT_ARITY_LOOP_IS_ITERATING |
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 | template< NDNBOOST_FT_tplargs(NDNBOOST_PP_IDENTITY(typename)) > |
| 37 | struct NDNBOOST_FT_make_type(NDNBOOST_FT_flags,NDNBOOST_FT_cc_id,NDNBOOST_FT_arity) |
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 NDNBOOST_FT_type ; |
Jeff Thompson | a28eed8 | 2013-08-22 16:21:10 -0700 | [diff] [blame] | 40 | }; |
| 41 | |
| 42 | template<> |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame] | 43 | struct synthesize_impl_o< NDNBOOST_FT_flags, NDNBOOST_FT_cc_id, NDNBOOST_FT_n > |
Jeff Thompson | a28eed8 | 2013-08-22 16:21:10 -0700 | [diff] [blame] | 44 | { |
| 45 | template<typename S> struct synthesize_impl_i |
| 46 | { |
| 47 | private: |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame] | 48 | typedef typename mpl::begin<S>::type NDNBOOST_FT_iter(0); |
| 49 | # if NDNBOOST_FT_n > 1 |
| 50 | # define NDNBOOST_PP_LOCAL_MACRO(i) typedef typename mpl::next< \ |
| 51 | NDNBOOST_FT_iter(NDNBOOST_PP_DEC(i)) >::type NDNBOOST_FT_iter(i); |
| 52 | # define NDNBOOST_PP_LOCAL_LIMITS (1,NDNBOOST_FT_n-1) |
| 53 | # include NDNBOOST_PP_LOCAL_ITERATE() |
Jeff Thompson | a28eed8 | 2013-08-22 16:21:10 -0700 | [diff] [blame] | 54 | # endif |
| 55 | public: |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame] | 56 | typedef typename detail::NDNBOOST_FT_make_type(NDNBOOST_FT_flags,NDNBOOST_FT_cc_id,NDNBOOST_FT_arity) |
| 57 | < typename mpl::deref< NDNBOOST_FT_iter(0) >::type |
| 58 | # if NDNBOOST_FT_mfp |
Jeff Thompson | a28eed8 | 2013-08-22 16:21:10 -0700 | [diff] [blame] | 59 | , typename detail::cv_traits< |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame] | 60 | typename mpl::deref< NDNBOOST_FT_iter(1) >::type >::type |
Jeff Thompson | a28eed8 | 2013-08-22 16:21:10 -0700 | [diff] [blame] | 61 | # endif |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame] | 62 | # if NDNBOOST_FT_n > (NDNBOOST_FT_mfp+1) |
| 63 | # define NDNBOOST_PP_LOCAL_LIMITS (NDNBOOST_FT_mfp+1,NDNBOOST_FT_n-1) |
| 64 | # define NDNBOOST_PP_LOCAL_MACRO(i) \ |
| 65 | , typename mpl::deref< NDNBOOST_FT_iter(i) >::type |
| 66 | # include NDNBOOST_PP_LOCAL_ITERATE() |
Jeff Thompson | a28eed8 | 2013-08-22 16:21:10 -0700 | [diff] [blame] | 67 | # endif |
| 68 | >::type type; |
| 69 | }; |
| 70 | }; |
| 71 | |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame] | 72 | #elif NDNBOOST_FT_ARITY_LOOP_SUFFIX |
Jeff Thompson | a28eed8 | 2013-08-22 16:21:10 -0700 | [diff] [blame] | 73 | |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame] | 74 | # ifdef NDNBOOST_FT_flags |
| 75 | # undef NDNBOOST_FT_make_type |
| 76 | # undef NDNBOOST_FT_make_type_impl |
Jeff Thompson | a28eed8 | 2013-08-22 16:21:10 -0700 | [diff] [blame] | 77 | # else |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame] | 78 | NDNBOOST_PP_EXPAND(#) undef NDNBOOST_FT_make_type |
| 79 | NDNBOOST_PP_EXPAND(#) undef NDNBOOST_FT_make_type_impl |
Jeff Thompson | a28eed8 | 2013-08-22 16:21:10 -0700 | [diff] [blame] | 80 | # endif |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame] | 81 | # undef NDNBOOST_FT_iter |
| 82 | # undef NDNBOOST_FT_type_name |
Jeff Thompson | a28eed8 | 2013-08-22 16:21:10 -0700 | [diff] [blame] | 83 | |
| 84 | #else |
| 85 | # error "attempt to use arity loop master file without loop" |
| 86 | #endif |
| 87 | |