File indexing completed on 2025-09-18 08:43:12
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015 #ifndef BOOST_GEOMETRY_INDEX_DETAIL_ALGORITHMS_IS_VALID_HPP
0016 #define BOOST_GEOMETRY_INDEX_DETAIL_ALGORITHMS_IS_VALID_HPP
0017
0018 #include <cstddef>
0019
0020 #include <boost/geometry/core/access.hpp>
0021 #include <boost/geometry/core/coordinate_dimension.hpp>
0022 #include <boost/geometry/core/static_assert.hpp>
0023
0024 namespace boost { namespace geometry { namespace index { namespace detail {
0025
0026 namespace dispatch {
0027
0028 template <typename Box,
0029 std::size_t Dimension = geometry::dimension<Box>::value>
0030 struct is_valid_box
0031 {
0032 static inline bool apply(Box const& b)
0033 {
0034 return is_valid_box<Box, Dimension - 1>::apply(b) &&
0035 ( get<min_corner, Dimension - 1>(b) <= get<max_corner, Dimension - 1>(b) );
0036 }
0037 };
0038
0039 template <typename Box>
0040 struct is_valid_box<Box, 1>
0041 {
0042 static inline bool apply(Box const& b)
0043 {
0044 return get<min_corner, 0>(b) <= get<max_corner, 0>(b);
0045 }
0046 };
0047
0048 template <typename Indexable, typename Tag = geometry::tag_t<Indexable>>
0049 struct is_valid
0050 {
0051 BOOST_GEOMETRY_STATIC_ASSERT_FALSE(
0052 "Not implemented for this Indexable type.",
0053 Indexable, Tag);
0054 };
0055
0056 template <typename Indexable>
0057 struct is_valid<Indexable, point_tag>
0058 {
0059 static inline bool apply(Indexable const&)
0060 {
0061 return true;
0062 }
0063 };
0064
0065 template <typename Indexable>
0066 struct is_valid<Indexable, box_tag>
0067 {
0068 static inline bool apply(Indexable const& b)
0069 {
0070 return dispatch::is_valid_box<Indexable>::apply(b);
0071 }
0072 };
0073
0074 template <typename Indexable>
0075 struct is_valid<Indexable, segment_tag>
0076 {
0077 static inline bool apply(Indexable const&)
0078 {
0079 return true;
0080 }
0081 };
0082
0083 }
0084
0085 template <typename Indexable>
0086 inline bool is_valid(Indexable const& b)
0087 {
0088
0089
0090
0091 return dispatch::is_valid<Indexable>::apply(b);
0092 }
0093
0094 }}}}
0095
0096 #endif