blob: 622b47647ad628c606379845625ec130487f3fa6 [file] [log] [blame]
Jeff Thompsona28eed82013-08-22 16:21:10 -07001// Copyright (C) 2005 Arkadiy Vertleyb
2// Distributed under the Boost Software License, Version 1.0. (See accompanying
3// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
4
Jeff Thompson3d613fd2013-10-15 15:39:04 -07005#ifndef NDNBOOST_TYPEOF_ENCODE_DECODE_PARAMS_HPP_INCLUDED
6#define NDNBOOST_TYPEOF_ENCODE_DECODE_PARAMS_HPP_INCLUDED
Jeff Thompsona28eed82013-08-22 16:21:10 -07007
8#include <ndnboost/preprocessor/cat.hpp>
9#include <ndnboost/preprocessor/repetition/repeat.hpp>
10
11// Assumes iter0 contains initial iterator
12
Jeff Thompson3d613fd2013-10-15 15:39:04 -070013#define NDNBOOST_TYPEOF_DECODE_PARAM(z, n, text) \
Jeff Thompsona28eed82013-08-22 16:21:10 -070014 typedef ndnboost::type_of::decode_type<iter##n> decode##n; \
15 typedef typename decode##n::type p##n; \
Jeff Thompson3d613fd2013-10-15 15:39:04 -070016 typedef typename decode##n::iter NDNBOOST_PP_CAT(iter, NDNBOOST_PP_INC(n));
Jeff Thompsona28eed82013-08-22 16:21:10 -070017
Jeff Thompson3d613fd2013-10-15 15:39:04 -070018#define NDNBOOST_TYPEOF_DECODE_PARAMS(n)\
19 NDNBOOST_PP_REPEAT(n, NDNBOOST_TYPEOF_DECODE_PARAM, ~)
Jeff Thompsona28eed82013-08-22 16:21:10 -070020
21// The P0, P1, ... PN are encoded and added to V
22
Jeff Thompson3d613fd2013-10-15 15:39:04 -070023#define NDNBOOST_TYPEOF_ENCODE_PARAMS_BEGIN(z, n, text)\
Jeff Thompsona28eed82013-08-22 16:21:10 -070024 typename ndnboost::type_of::encode_type<
25
Jeff Thompson3d613fd2013-10-15 15:39:04 -070026#define NDNBOOST_TYPEOF_ENCODE_PARAMS_END(z, n, text)\
27 , NDNBOOST_PP_CAT(P, n)>::type
Jeff Thompsona28eed82013-08-22 16:21:10 -070028
Jeff Thompson3d613fd2013-10-15 15:39:04 -070029#define NDNBOOST_TYPEOF_ENCODE_PARAMS(n, ID) \
30 NDNBOOST_PP_REPEAT(n, NDNBOOST_TYPEOF_ENCODE_PARAMS_BEGIN, ~) \
Jeff Thompsona28eed82013-08-22 16:21:10 -070031 typename ndnboost::type_of::push_back<V, ndnboost::mpl::size_t<ID> >::type \
Jeff Thompson3d613fd2013-10-15 15:39:04 -070032 NDNBOOST_PP_REPEAT(n, NDNBOOST_TYPEOF_ENCODE_PARAMS_END, ~)
Jeff Thompsona28eed82013-08-22 16:21:10 -070033
Jeff Thompson3d613fd2013-10-15 15:39:04 -070034#endif//NDNBOOST_TYPEOF_ENCODE_DECODE_PARAMS_HPP_INCLUDED