Jeff Thompson | a28eed8 | 2013-08-22 16:21:10 -0700 | [diff] [blame] | 1 | // Copyright (C) 2004 Arkadiy Vertleyb |
| 2 | // Use, modification and distribution is subject to the Boost Software |
| 3 | // License, Version 1.0. (http://www.boost.org/LICENSE_1_0.txt) |
| 4 | |
| 5 | #include <ndnboost/typeof/encode_decode_params.hpp> |
| 6 | |
| 7 | // member functions |
| 8 | |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame] | 9 | template<class V, class T, class R NDNBOOST_PP_ENUM_TRAILING_PARAMS(n, class P)> |
| 10 | struct encode_type_impl<V, R(T::*)(NDNBOOST_PP_ENUM_PARAMS(n, P)) NDNBOOST_TYPEOF_qualifier> |
Jeff Thompson | a28eed8 | 2013-08-22 16:21:10 -0700 | [diff] [blame] | 11 | { |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame] | 12 | typedef R NDNBOOST_PP_CAT(P, n); |
| 13 | typedef T NDNBOOST_PP_CAT(P, NDNBOOST_PP_INC(n)); |
| 14 | typedef NDNBOOST_TYPEOF_ENCODE_PARAMS(NDNBOOST_PP_ADD(n, 2), NDNBOOST_TYPEOF_id + n) type; |
Jeff Thompson | a28eed8 | 2013-08-22 16:21:10 -0700 | [diff] [blame] | 15 | }; |
| 16 | |
| 17 | template<class Iter> |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame] | 18 | struct decode_type_impl<ndnboost::mpl::size_t<NDNBOOST_TYPEOF_id + n>, Iter> |
Jeff Thompson | a28eed8 | 2013-08-22 16:21:10 -0700 | [diff] [blame] | 19 | { |
| 20 | typedef Iter iter0; |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame] | 21 | NDNBOOST_TYPEOF_DECODE_PARAMS(NDNBOOST_PP_ADD(n, 2)) |
Jeff Thompson | a28eed8 | 2013-08-22 16:21:10 -0700 | [diff] [blame] | 22 | template<class T> struct workaround{ |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame] | 23 | typedef NDNBOOST_PP_CAT(p, n)(T::*type)(NDNBOOST_PP_ENUM_PARAMS(n, p)) NDNBOOST_TYPEOF_qualifier; |
Jeff Thompson | a28eed8 | 2013-08-22 16:21:10 -0700 | [diff] [blame] | 24 | }; |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame] | 25 | typedef typename workaround<NDNBOOST_PP_CAT(p, NDNBOOST_PP_INC(n))>::type type; |
| 26 | typedef NDNBOOST_PP_CAT(iter, NDNBOOST_PP_ADD(n, 2)) iter; |
Jeff Thompson | a28eed8 | 2013-08-22 16:21:10 -0700 | [diff] [blame] | 27 | }; |
| 28 | |
| 29 | // undef parameters |
| 30 | |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame] | 31 | #undef NDNBOOST_TYPEOF_id |
| 32 | #undef NDNBOOST_TYPEOF_qualifier |