blob: ad59bf2cd5568acd4eeefc5c779d03880139310b [file] [log] [blame]
Jeff Thompsona28eed82013-08-22 16:21:10 -07001// Copyright (C) 2004 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_TYPE_ENCODING_HPP_INCLUDED
6#define NDNBOOST_TYPEOF_TYPE_ENCODING_HPP_INCLUDED
Jeff Thompsona28eed82013-08-22 16:21:10 -07007
Jeff Thompson3d613fd2013-10-15 15:39:04 -07008#define NDNBOOST_TYPEOF_REGISTER_TYPE_IMPL(T, Id) \
Jeff Thompsona28eed82013-08-22 16:21:10 -07009 \
10 template<class V> struct encode_type_impl<V, T > \
11 : ndnboost::type_of::push_back<V, ndnboost::mpl::size_t<Id> > \
12 {}; \
13 template<class Iter> struct decode_type_impl<ndnboost::mpl::size_t<Id>, Iter> \
14 { \
15 typedef T type; \
16 typedef Iter iter; \
17 };
18
Jeff Thompson3d613fd2013-10-15 15:39:04 -070019#define NDNBOOST_TYPEOF_REGISTER_TYPE_EXPLICIT_ID(Type, Id) \
20 NDNBOOST_TYPEOF_BEGIN_ENCODE_NS \
21 NDNBOOST_TYPEOF_REGISTER_TYPE_IMPL(Type, Id) \
22 NDNBOOST_TYPEOF_END_ENCODE_NS
Jeff Thompsona28eed82013-08-22 16:21:10 -070023
Jeff Thompson3d613fd2013-10-15 15:39:04 -070024#define NDNBOOST_TYPEOF_REGISTER_TYPE(Type) \
25 NDNBOOST_TYPEOF_REGISTER_TYPE_EXPLICIT_ID(Type, NDNBOOST_TYPEOF_UNIQUE_ID())
Jeff Thompsona28eed82013-08-22 16:21:10 -070026
Jeff Thompson3d613fd2013-10-15 15:39:04 -070027#endif//NDNBOOST_TYPEOF_TYPE_ENCODING_HPP_INCLUDED