annotate DEPENDENCIES/generic/include/boost/geometry/geometries/adapted/c_array.hpp @ 133:4acb5d8d80b6 tip

Don't fail environmental check if README.md exists (but .txt and no-suffix don't)
author Chris Cannam
date Tue, 30 Jul 2019 12:25:44 +0100
parents 2665513ce2d3
children
rev   line source
Chris@16 1 // Boost.Geometry (aka GGL, Generic Geometry Library)
Chris@16 2
Chris@16 3 // Copyright (c) 2008-2012 Bruno Lalande, Paris, France.
Chris@16 4 // Copyright (c) 2007-2012 Barend Gehrels, Amsterdam, the Netherlands.
Chris@16 5 // Copyright (c) 2009-2012 Mateusz Loskot, London, UK.
Chris@16 6
Chris@16 7 // Parts of Boost.Geometry are redesigned from Geodan's Geographic Library
Chris@16 8 // (geolib/GGL), copyright (c) 1995-2010 Geodan, Amsterdam, the Netherlands.
Chris@16 9
Chris@16 10 // Use, modification and distribution is subject to the Boost Software License,
Chris@16 11 // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
Chris@16 12 // http://www.boost.org/LICENSE_1_0.txt)
Chris@16 13
Chris@16 14 #ifndef BOOST_GEOMETRY_GEOMETRIES_ADAPTED_C_ARRAY_HPP
Chris@16 15 #define BOOST_GEOMETRY_GEOMETRIES_ADAPTED_C_ARRAY_HPP
Chris@16 16
Chris@16 17 #include <cstddef>
Chris@16 18
Chris@16 19 #include <boost/type_traits/is_arithmetic.hpp>
Chris@16 20
Chris@16 21 #include <boost/geometry/core/access.hpp>
Chris@16 22 #include <boost/geometry/core/cs.hpp>
Chris@16 23 #include <boost/geometry/core/coordinate_dimension.hpp>
Chris@16 24 #include <boost/geometry/core/coordinate_type.hpp>
Chris@16 25 #include <boost/geometry/core/tags.hpp>
Chris@16 26
Chris@16 27 namespace boost { namespace geometry
Chris@16 28 {
Chris@16 29
Chris@16 30
Chris@16 31 #ifndef DOXYGEN_NO_TRAITS_SPECIALIZATIONS
Chris@16 32 namespace traits
Chris@16 33 {
Chris@16 34
Chris@16 35
Chris@16 36 #ifndef DOXYGEN_NO_DETAIL
Chris@16 37 namespace detail
Chris@16 38 {
Chris@16 39
Chris@16 40
Chris@16 41 // Create class and specialization to indicate the tag
Chris@16 42 // for normal cases and the case that the type of the c-array is arithmetic
Chris@16 43 template <bool>
Chris@16 44 struct c_array_tag
Chris@16 45 {
Chris@16 46 typedef geometry_not_recognized_tag type;
Chris@16 47 };
Chris@16 48
Chris@16 49
Chris@16 50 template <>
Chris@16 51 struct c_array_tag<true>
Chris@16 52 {
Chris@16 53 typedef point_tag type;
Chris@16 54 };
Chris@16 55
Chris@16 56
Chris@16 57 } // namespace detail
Chris@16 58 #endif // DOXYGEN_NO_DETAIL
Chris@16 59
Chris@16 60
Chris@16 61 // Assign the point-tag, preventing arrays of points getting a point-tag
Chris@16 62 template <typename CoordinateType, std::size_t DimensionCount>
Chris@16 63 struct tag<CoordinateType[DimensionCount]>
Chris@16 64 : detail::c_array_tag<boost::is_arithmetic<CoordinateType>::value> {};
Chris@16 65
Chris@16 66
Chris@16 67 template <typename CoordinateType, std::size_t DimensionCount>
Chris@16 68 struct coordinate_type<CoordinateType[DimensionCount]>
Chris@16 69 {
Chris@16 70 typedef CoordinateType type;
Chris@16 71 };
Chris@16 72
Chris@16 73
Chris@16 74 template <typename CoordinateType, std::size_t DimensionCount>
Chris@16 75 struct dimension<CoordinateType[DimensionCount]>: boost::mpl::int_<DimensionCount> {};
Chris@16 76
Chris@16 77
Chris@16 78 template <typename CoordinateType, std::size_t DimensionCount, std::size_t Dimension>
Chris@16 79 struct access<CoordinateType[DimensionCount], Dimension>
Chris@16 80 {
Chris@16 81 static inline CoordinateType get(CoordinateType const p[DimensionCount])
Chris@16 82 {
Chris@16 83 return p[Dimension];
Chris@16 84 }
Chris@16 85
Chris@16 86 static inline void set(CoordinateType p[DimensionCount],
Chris@16 87 CoordinateType const& value)
Chris@16 88 {
Chris@16 89 p[Dimension] = value;
Chris@16 90 }
Chris@16 91 };
Chris@16 92
Chris@16 93
Chris@16 94 } // namespace traits
Chris@16 95 #endif // DOXYGEN_NO_TRAITS_SPECIALIZATIONS
Chris@16 96
Chris@16 97
Chris@16 98 }} // namespace boost::geometry
Chris@16 99
Chris@16 100
Chris@16 101 #define BOOST_GEOMETRY_REGISTER_C_ARRAY_CS(CoordinateSystem) \
Chris@16 102 namespace boost { namespace geometry { namespace traits { \
Chris@16 103 template <typename T, std::size_t N> \
Chris@16 104 struct coordinate_system<T[N]> \
Chris@16 105 { \
Chris@16 106 typedef CoordinateSystem type; \
Chris@16 107 }; \
Chris@16 108 }}}
Chris@16 109
Chris@16 110
Chris@16 111 #endif // BOOST_GEOMETRY_GEOMETRIES_ADAPTED_C_ARRAY_HPP