Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:35:27

0001 // Boost.Geometry (aka GGL, Generic Geometry Library)
0002 
0003 // Copyright (c) 2010 Alfredo Correa
0004 // Copyright (c) 2010-2012 Barend Gehrels, Amsterdam, the Netherlands.
0005 
0006 // This file was modified by Oracle on 2020.
0007 // Modifications copyright (c) 2020 Oracle and/or its affiliates.
0008 // Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
0009 
0010 // Use, modification and distribution is subject to the Boost Software License,
0011 // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
0012 // http://www.boost.org/LICENSE_1_0.txt)
0013 
0014 #ifndef BOOST_GEOMETRY_GEOMETRIES_ADAPTED_BOOST_ARRAY_HPP
0015 #define BOOST_GEOMETRY_GEOMETRIES_ADAPTED_BOOST_ARRAY_HPP
0016 
0017 
0018 #ifdef BOOST_GEOMETRY_ADAPTED_BOOST_ARRAY_TAG_DEFINED
0019 #error Include either "boost_array_as_point" or \
0020     "boost_array_as_linestring" or "boost_array_as_ring" \
0021     or "boost_array_as_multi_point" to adapt a boost_array
0022 #endif
0023 
0024 #define BOOST_GEOMETRY_ADAPTED_BOOST_ARRAY_TAG_DEFINED
0025 
0026 
0027 #include <cstddef>
0028 #include <type_traits>
0029 
0030 #include <boost/geometry/core/access.hpp>
0031 #include <boost/geometry/core/cs.hpp>
0032 #include <boost/geometry/core/coordinate_dimension.hpp>
0033 #include <boost/geometry/core/coordinate_type.hpp>
0034 #include <boost/geometry/core/tags.hpp>
0035 
0036 #include <boost/array.hpp>
0037 
0038 namespace boost { namespace geometry
0039 {
0040 
0041 
0042 #ifndef DOXYGEN_NO_TRAITS_SPECIALIZATIONS
0043 namespace traits
0044 {
0045 
0046 
0047 #ifndef DOXYGEN_NO_DETAIL
0048 namespace detail
0049 {
0050 
0051 
0052 // Create class and specialization to indicate the tag
0053 // for normal cases and the case that the type of the c-array is arithmetic
0054 template <bool>
0055 struct boost_array_tag
0056 {
0057     typedef geometry_not_recognized_tag type;
0058 };
0059 
0060 
0061 template <>
0062 struct boost_array_tag<true>
0063 {
0064     typedef point_tag type;
0065 };
0066 
0067 
0068 } // namespace detail
0069 #endif // DOXYGEN_NO_DETAIL
0070 
0071 
0072 // Assign the point-tag, preventing arrays of points getting a point-tag
0073 template <typename CoordinateType, std::size_t DimensionCount>
0074 struct tag<boost::array<CoordinateType, DimensionCount> >
0075     : detail::boost_array_tag<std::is_arithmetic<CoordinateType>::value> {};
0076 
0077 
0078 template <typename CoordinateType, std::size_t DimensionCount>
0079 struct coordinate_type<boost::array<CoordinateType, DimensionCount> >
0080 {
0081     typedef CoordinateType type;
0082 };
0083 
0084 
0085 template <typename CoordinateType, std::size_t DimensionCount>
0086 struct dimension<boost::array<CoordinateType, DimensionCount> >
0087     : std::integral_constant<std::size_t, DimensionCount>
0088 {};
0089 
0090 
0091 template <typename CoordinateType, std::size_t DimensionCount, std::size_t Dimension>
0092 struct access<boost::array<CoordinateType, DimensionCount>, Dimension>
0093 {
0094     static inline CoordinateType get(boost::array<CoordinateType, DimensionCount> const& a)
0095     {
0096         return a[Dimension];
0097     }
0098 
0099     static inline void set(boost::array<CoordinateType, DimensionCount>& a,
0100         CoordinateType const& value)
0101     {
0102         a[Dimension] = value;
0103     }
0104 };
0105 
0106 
0107 } // namespace traits
0108 #endif // DOXYGEN_NO_TRAITS_SPECIALIZATIONS
0109 
0110 
0111 }} // namespace boost::geometry
0112 
0113 
0114 #define BOOST_GEOMETRY_REGISTER_BOOST_ARRAY_CS(CoordinateSystem) \
0115     namespace boost { namespace geometry { namespace traits { \
0116     template <class T, std::size_t N> \
0117     struct coordinate_system<boost::array<T, N> > \
0118     { \
0119         typedef CoordinateSystem type; \
0120     }; \
0121     }}}
0122 
0123 
0124 #endif // BOOST_GEOMETRY_GEOMETRIES_ADAPTED_BOOST_ARRAY_HPP
0125