Jeff Thompson | a28eed8 | 2013-08-22 16:21:10 -0700 | [diff] [blame] | 1 | // 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 Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame] | 5 | #ifndef NDNBOOST_TYPEOF_TYPE_ENCODING_HPP_INCLUDED |
| 6 | #define NDNBOOST_TYPEOF_TYPE_ENCODING_HPP_INCLUDED |
Jeff Thompson | a28eed8 | 2013-08-22 16:21:10 -0700 | [diff] [blame] | 7 | |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame] | 8 | #define NDNBOOST_TYPEOF_REGISTER_TYPE_IMPL(T, Id) \ |
Jeff Thompson | a28eed8 | 2013-08-22 16:21:10 -0700 | [diff] [blame] | 9 | \ |
| 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 Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame] | 19 | #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 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 | #define NDNBOOST_TYPEOF_REGISTER_TYPE(Type) \ |
| 25 | NDNBOOST_TYPEOF_REGISTER_TYPE_EXPLICIT_ID(Type, NDNBOOST_TYPEOF_UNIQUE_ID()) |
Jeff Thompson | a28eed8 | 2013-08-22 16:21:10 -0700 | [diff] [blame] | 26 | |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame] | 27 | #endif//NDNBOOST_TYPEOF_TYPE_ENCODING_HPP_INCLUDED |