File indexing completed on 2025-09-18 08:43:10
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015 #ifndef BOOST_GEOMETRY_GEOMETRIES_CONCEPTS_BOX_CONCEPT_HPP
0016 #define BOOST_GEOMETRY_GEOMETRIES_CONCEPTS_BOX_CONCEPT_HPP
0017
0018 #include <cstddef>
0019
0020 #include <boost/concept_check.hpp>
0021 #include <boost/core/ignore_unused.hpp>
0022
0023 #include <boost/geometry/core/access.hpp>
0024 #include <boost/geometry/core/coordinate_dimension.hpp>
0025 #include <boost/geometry/core/point_type.hpp>
0026
0027 #include <boost/geometry/geometries/concepts/concept_type.hpp>
0028
0029
0030 namespace boost { namespace geometry { namespace concepts
0031 {
0032
0033 template <typename Geometry>
0034 class Box
0035 {
0036 #ifndef DOXYGEN_NO_CONCEPT_MEMBERS
0037 using point_type = point_type_t<Geometry>;
0038
0039 template
0040 <
0041 std::size_t Index,
0042 std::size_t Dimension,
0043 std::size_t DimensionCount
0044 >
0045 struct dimension_checker
0046 {
0047 static void apply()
0048 {
0049 Geometry* b = 0;
0050 geometry::set<Index, Dimension>(*b, geometry::get<Index, Dimension>(*b));
0051 dimension_checker<Index, Dimension + 1, DimensionCount>::apply();
0052 }
0053 };
0054
0055 template <std::size_t Index, std::size_t DimensionCount>
0056 struct dimension_checker<Index, DimensionCount, DimensionCount>
0057 {
0058 static void apply() {}
0059 };
0060
0061 public :
0062 BOOST_CONCEPT_USAGE(Box)
0063 {
0064 static const std::size_t n = dimension<Geometry>::type::value;
0065 dimension_checker<min_corner, 0, n>::apply();
0066 dimension_checker<max_corner, 0, n>::apply();
0067 }
0068 #endif
0069 };
0070
0071
0072
0073
0074
0075
0076
0077
0078 template <typename Geometry>
0079 class ConstBox
0080 {
0081 #ifndef DOXYGEN_NO_CONCEPT_MEMBERS
0082 using point_type = point_type_t<Geometry>;
0083 using coordinate_type = coordinate_type_t<Geometry>;
0084
0085 template
0086 <
0087 std::size_t Index,
0088 std::size_t Dimension,
0089 std::size_t DimensionCount
0090 >
0091 struct dimension_checker
0092 {
0093 static void apply()
0094 {
0095 const Geometry* b = 0;
0096 coordinate_type coord(geometry::get<Index, Dimension>(*b));
0097 boost::ignore_unused(coord);
0098 dimension_checker<Index, Dimension + 1, DimensionCount>::apply();
0099 }
0100 };
0101
0102 template <std::size_t Index, std::size_t DimensionCount>
0103 struct dimension_checker<Index, DimensionCount, DimensionCount>
0104 {
0105 static void apply() {}
0106 };
0107
0108 public :
0109 BOOST_CONCEPT_USAGE(ConstBox)
0110 {
0111 static const std::size_t n = dimension<Geometry>::type::value;
0112 dimension_checker<min_corner, 0, n>::apply();
0113 dimension_checker<max_corner, 0, n>::apply();
0114 }
0115 #endif
0116 };
0117
0118
0119 template <typename Geometry>
0120 struct concept_type<Geometry, box_tag>
0121 {
0122 using type = Box<Geometry>;
0123 };
0124
0125 template <typename Geometry>
0126 struct concept_type<Geometry const, box_tag>
0127 {
0128 using type = ConstBox<Geometry>;
0129 };
0130
0131
0132 }}}
0133
0134
0135 #endif