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