File indexing completed on 2025-01-31 09:43:58
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016 #ifndef BOOST_GEOMETRY_UTIL_CALCULATION_TYPE_HPP
0017 #define BOOST_GEOMETRY_UTIL_CALCULATION_TYPE_HPP
0018
0019
0020 #include <boost/static_assert.hpp>
0021
0022 #include <boost/geometry/util/select_coordinate_type.hpp>
0023 #include <boost/geometry/util/select_most_precise.hpp>
0024
0025
0026 namespace boost { namespace geometry
0027 {
0028
0029 namespace util
0030 {
0031
0032 namespace detail
0033 {
0034
0035 struct default_integral
0036 {
0037 typedef long long type;
0038 };
0039
0040
0041
0042
0043
0044
0045
0046
0047 template
0048 <
0049 typename Type,
0050 typename CalculationType,
0051 typename DefaultFloatingPointCalculationType,
0052 typename DefaultIntegralCalculationType
0053 >
0054 struct calculation_type
0055 {
0056 BOOST_STATIC_ASSERT((
0057 std::is_fundamental
0058 <
0059 DefaultFloatingPointCalculationType
0060 >::value
0061 ));
0062 BOOST_STATIC_ASSERT((
0063 std::is_fundamental
0064 <
0065 DefaultIntegralCalculationType
0066 >::value
0067 ));
0068
0069
0070 typedef std::conditional_t
0071 <
0072 std::is_void<CalculationType>::value,
0073 std::conditional_t
0074 <
0075 std::is_floating_point<Type>::value,
0076 typename select_most_precise
0077 <
0078 DefaultFloatingPointCalculationType,
0079 Type
0080 >::type,
0081 typename select_most_precise
0082 <
0083 DefaultIntegralCalculationType,
0084 Type
0085 >::type
0086 >,
0087 CalculationType
0088 > type;
0089 };
0090
0091 }
0092
0093
0094 namespace calculation_type
0095 {
0096
0097 namespace geometric
0098 {
0099
0100 template
0101 <
0102 typename Geometry,
0103 typename CalculationType,
0104 typename DefaultFloatingPointCalculationType = double,
0105 typename DefaultIntegralCalculationType = detail::default_integral::type
0106 >
0107 struct unary
0108 {
0109 typedef typename detail::calculation_type
0110 <
0111 typename geometry::coordinate_type<Geometry>::type,
0112 CalculationType,
0113 DefaultFloatingPointCalculationType,
0114 DefaultIntegralCalculationType
0115 >::type type;
0116 };
0117
0118 template
0119 <
0120 typename Geometry1,
0121 typename Geometry2,
0122 typename CalculationType,
0123 typename DefaultFloatingPointCalculationType = double,
0124 typename DefaultIntegralCalculationType = detail::default_integral::type
0125 >
0126 struct binary
0127 {
0128 typedef typename detail::calculation_type
0129 <
0130 typename select_coordinate_type<Geometry1, Geometry2>::type,
0131 CalculationType,
0132 DefaultFloatingPointCalculationType,
0133 DefaultIntegralCalculationType
0134 >::type type;
0135 };
0136
0137
0138
0139
0140
0141 template
0142 <
0143 typename Geometry1,
0144 typename Geometry2,
0145 typename Geometry3,
0146 typename CalculationType,
0147 typename DefaultFloatingPointCalculationType = double,
0148 typename DefaultIntegralCalculationType = detail::default_integral::type
0149 >
0150 struct ternary
0151 {
0152 typedef typename detail::calculation_type
0153 <
0154 typename select_most_precise
0155 <
0156 typename coordinate_type<Geometry1>::type,
0157 typename select_coordinate_type
0158 <
0159 Geometry2,
0160 Geometry3
0161 >::type
0162 >::type,
0163 CalculationType,
0164 DefaultFloatingPointCalculationType,
0165 DefaultIntegralCalculationType
0166 >::type type;
0167 };
0168
0169 }}
0170
0171 }
0172
0173 }}
0174
0175
0176 #endif