blob: 96bd961250d6a030f3eabd33303f4601d9a0418c [file] [log] [blame]
Jeff Thompsonef2d5a42013-08-22 19:09:24 -07001//
2//! Copyright (c) 2011-2012
3//! Brandon Kohn
4//
5// Distributed under the Boost Software License, Version 1.0. (See
6// accompanying file LICENSE_1_0.txt or copy at
7// http://www.boost.org/LICENSE_1_0.txt)
8//
9
Jeff Thompson3d613fd2013-10-15 15:39:04 -070010#if !defined(NDNBOOST_NUMERIC_CONVERSION_DONT_USE_PREPROCESSED_FILES)
Jeff Thompsonef2d5a42013-08-22 19:09:24 -070011
12 #include <ndnboost/numeric/conversion/detail/preprocessed/numeric_cast_traits_common.hpp>
13
Jeff Thompson3d613fd2013-10-15 15:39:04 -070014 #if !defined(NDNBOOST_NO_LONG_LONG)
Jeff Thompsonef2d5a42013-08-22 19:09:24 -070015 #include <ndnboost/numeric/conversion/detail/preprocessed/numeric_cast_traits_long_long.hpp>
16 #endif
17
18#else
Jeff Thompson3d613fd2013-10-15 15:39:04 -070019#if !NDNBOOST_PP_IS_ITERATING
Jeff Thompsonef2d5a42013-08-22 19:09:24 -070020
21 #include <ndnboost/preprocessor/seq/elem.hpp>
22 #include <ndnboost/preprocessor/seq/size.hpp>
23 #include <ndnboost/preprocessor/iteration/iterate.hpp>
24
Jeff Thompson3d613fd2013-10-15 15:39:04 -070025 #if defined(__WAVE__) && defined(NDNBOOST_NUMERIC_CONVERSION_CREATE_PREPROCESSED_FILES)
Jeff Thompsonef2d5a42013-08-22 19:09:24 -070026 #pragma wave option(preserve: 2, line: 0, output: "preprocessed/numeric_cast_traits_common.hpp")
27 #endif
28//
29//! Copyright (c) 2011-2012
30//! Brandon Kohn
31//
32// Distributed under the Boost Software License, Version 1.0. (See
33// accompanying file LICENSE_1_0.txt or copy at
34// http://www.boost.org/LICENSE_1_0.txt)
35//
Jeff Thompson3d613fd2013-10-15 15:39:04 -070036 #if defined(__WAVE__) && defined(NDNBOOST_NUMERIC_CONVERSION_CREATE_PREPROCESSED_FILES)
Jeff Thompsonef2d5a42013-08-22 19:09:24 -070037 #pragma wave option(preserve: 1)
38 #endif
39
40 //! These are the assumed common built in fundamental types (not typedefs/macros.)
Jeff Thompson3d613fd2013-10-15 15:39:04 -070041 #define NDNBOOST_NUMERIC_CONVERSION_BASE_BUILTIN_TYPES() \
Jeff Thompsonef2d5a42013-08-22 19:09:24 -070042 (char) \
43 (signed char) \
44 (unsigned char) \
45 (short) \
46 (unsigned short) \
47 (int) \
48 (unsigned int) \
49 (long) \
50 (unsigned long) \
51 (float) \
52 (double) \
53 (long double) \
54 /***/
55
Jeff Thompson3d613fd2013-10-15 15:39:04 -070056 #define NDNBOOST_NUMERIC_CONVERSION_SEQ_A() NDNBOOST_NUMERIC_CONVERSION_BASE_BUILTIN_TYPES()
57 #define NDNBOOST_NUMERIC_CONVERSION_SEQ_B() NDNBOOST_NUMERIC_CONVERSION_BASE_BUILTIN_TYPES()
Jeff Thompsonef2d5a42013-08-22 19:09:24 -070058
59namespace ndnboost { namespace numeric {
60
Jeff Thompson3d613fd2013-10-15 15:39:04 -070061 #define NDNBOOST_PP_ITERATION_PARAMS_1 (3, (0, NDNBOOST_PP_DEC(NDNBOOST_PP_SEQ_SIZE(NDNBOOST_NUMERIC_CONVERSION_SEQ_A())), <ndnboost/numeric/conversion/detail/numeric_cast_traits.hpp>))
62 #include NDNBOOST_PP_ITERATE()
Jeff Thompsonef2d5a42013-08-22 19:09:24 -070063
64}}//namespace ndnboost::numeric;
65
Jeff Thompson3d613fd2013-10-15 15:39:04 -070066 #if defined(__WAVE__) && defined(NDNBOOST_NUMERIC_CONVERSION_CREATE_PREPROCESSED_FILES)
Jeff Thompsonef2d5a42013-08-22 19:09:24 -070067 #pragma wave option(output: null)
68 #endif
69
Jeff Thompson3d613fd2013-10-15 15:39:04 -070070 #if ( defined(__WAVE__) && defined(NDNBOOST_NUMERIC_CONVERSION_CREATE_PREPROCESSED_FILES) ) || !defined(NDNBOOST_NO_LONG_LONG)
Jeff Thompsonef2d5a42013-08-22 19:09:24 -070071
Jeff Thompson3d613fd2013-10-15 15:39:04 -070072 #undef NDNBOOST_NUMERIC_CONVERSION_SEQ_A
73 #undef NDNBOOST_NUMERIC_CONVERSION_SEQ_B
Jeff Thompsonef2d5a42013-08-22 19:09:24 -070074
Jeff Thompson3d613fd2013-10-15 15:39:04 -070075 #if defined(__WAVE__) && defined(NDNBOOST_NUMERIC_CONVERSION_CREATE_PREPROCESSED_FILES)
Jeff Thompsonef2d5a42013-08-22 19:09:24 -070076 #pragma wave option(preserve: 2, line: 0, output: "preprocessed/numeric_cast_traits_long_long.hpp")
77 #endif
78
79//
80//! Copyright (c) 2011-2012
81//! Brandon Kohn
82//
83// Distributed under the Boost Software License, Version 1.0. (See
84// accompanying file LICENSE_1_0.txt or copy at
85// http://www.boost.org/LICENSE_1_0.txt)
86//
Jeff Thompson3d613fd2013-10-15 15:39:04 -070087 #if defined(__WAVE__) && defined(NDNBOOST_NUMERIC_CONVERSION_CREATE_PREPROCESSED_FILES)
Jeff Thompsonef2d5a42013-08-22 19:09:24 -070088 #pragma wave option(preserve: 1)
89 #endif
90
91namespace ndnboost { namespace numeric {
92
Jeff Thompson3d613fd2013-10-15 15:39:04 -070093 #define NDNBOOST_NUMERIC_CONVERSION_SEQ_A() NDNBOOST_NUMERIC_CONVERSION_BASE_BUILTIN_TYPES()(ndnboost::long_long_type)(ndnboost::ulong_long_type)
94 #define NDNBOOST_NUMERIC_CONVERSION_SEQ_B() (ndnboost::long_long_type)(ndnboost::ulong_long_type)
Jeff Thompsonef2d5a42013-08-22 19:09:24 -070095
Jeff Thompson3d613fd2013-10-15 15:39:04 -070096 #define NDNBOOST_PP_ITERATION_PARAMS_1 (3, (0, NDNBOOST_PP_DEC(NDNBOOST_PP_SEQ_SIZE(NDNBOOST_NUMERIC_CONVERSION_SEQ_A())), <ndnboost/numeric/conversion/detail/numeric_cast_traits.hpp>))
97 #include NDNBOOST_PP_ITERATE()
Jeff Thompsonef2d5a42013-08-22 19:09:24 -070098
99}}//namespace ndnboost::numeric;
100
Jeff Thompson3d613fd2013-10-15 15:39:04 -0700101 #if defined(__WAVE__) && defined(NDNBOOST_NUMERIC_CONVERSION_CREATE_PREPROCESSED_FILES)
Jeff Thompsonef2d5a42013-08-22 19:09:24 -0700102 #pragma wave option(output: null)
103 #endif
104
105 #endif
106
Jeff Thompson3d613fd2013-10-15 15:39:04 -0700107 #undef NDNBOOST_NUMERIC_CONVERSION_BASE_BUILTIN_TYPES
108 #undef NDNBOOST_NUMERIC_CONVERSION_SEQ_A
109 #undef NDNBOOST_NUMERIC_CONVERSION_SEQ_B
Jeff Thompsonef2d5a42013-08-22 19:09:24 -0700110
Jeff Thompson3d613fd2013-10-15 15:39:04 -0700111#elif NDNBOOST_PP_ITERATION_DEPTH() == 1
Jeff Thompsonef2d5a42013-08-22 19:09:24 -0700112
Jeff Thompson3d613fd2013-10-15 15:39:04 -0700113 #define NDNBOOST_PP_ITERATION_PARAMS_2 (3, (0, NDNBOOST_PP_DEC(NDNBOOST_PP_SEQ_SIZE(NDNBOOST_NUMERIC_CONVERSION_SEQ_B())), <ndnboost/numeric/conversion/detail/numeric_cast_traits.hpp>))
114 #include NDNBOOST_PP_ITERATE()
Jeff Thompsonef2d5a42013-08-22 19:09:24 -0700115
Jeff Thompson3d613fd2013-10-15 15:39:04 -0700116#elif NDNBOOST_PP_ITERATION_DEPTH() == 2
Jeff Thompsonef2d5a42013-08-22 19:09:24 -0700117
118 //! Generate default traits for the specified source and target.
Jeff Thompson3d613fd2013-10-15 15:39:04 -0700119 #define NDNBOOST_NUMERIC_CONVERSION_A NDNBOOST_PP_FRAME_ITERATION(1)
120 #define NDNBOOST_NUMERIC_CONVERSION_B NDNBOOST_PP_FRAME_ITERATION(2)
Jeff Thompsonef2d5a42013-08-22 19:09:24 -0700121
122 template <>
123 struct numeric_cast_traits
124 <
Jeff Thompson3d613fd2013-10-15 15:39:04 -0700125 NDNBOOST_PP_SEQ_ELEM(NDNBOOST_NUMERIC_CONVERSION_A, NDNBOOST_NUMERIC_CONVERSION_SEQ_A())
126 , NDNBOOST_PP_SEQ_ELEM(NDNBOOST_NUMERIC_CONVERSION_B, NDNBOOST_NUMERIC_CONVERSION_SEQ_B())
Jeff Thompsonef2d5a42013-08-22 19:09:24 -0700127 >
128 {
129 typedef def_overflow_handler overflow_policy;
130 typedef UseInternalRangeChecker range_checking_policy;
Jeff Thompson3d613fd2013-10-15 15:39:04 -0700131 typedef Trunc<NDNBOOST_PP_SEQ_ELEM(NDNBOOST_NUMERIC_CONVERSION_B, NDNBOOST_NUMERIC_CONVERSION_SEQ_B())> rounding_policy;
Jeff Thompsonef2d5a42013-08-22 19:09:24 -0700132 };
133
Jeff Thompson3d613fd2013-10-15 15:39:04 -0700134 #undef NDNBOOST_NUMERIC_CONVERSION_A
135 #undef NDNBOOST_NUMERIC_CONVERSION_B
Jeff Thompsonef2d5a42013-08-22 19:09:24 -0700136
137#endif//! Depth 2.
Jeff Thompson3d613fd2013-10-15 15:39:04 -0700138#endif// NDNBOOST_NUMERIC_CONVERSION_DONT_USE_PREPROCESSED_FILES