1 // Boost.Geometry (aka GGL, Generic Geometry Library)
3 // Copyright (c) 2008-2012 Bruno Lalande, Paris, France.
4 // Copyright (c) 2008-2012 Barend Gehrels, Amsterdam, the Netherlands.
5 // Copyright (c) 2009-2012 Mateusz Loskot, London, UK.
7 // This file was modified by Oracle on 2020.
8 // Modifications copyright (c) 2020 Oracle and/or its affiliates.
9 // Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
11 // Parts of Boost.Geometry are redesigned from Geodan's Geographic Library
12 // (geolib/GGL), copyright (c) 1995-2010 Geodan, Amsterdam, the Netherlands.
14 // Use, modification and distribution is subject to the Boost Software License,
15 // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
16 // http://www.boost.org/LICENSE_1_0.txt)
19 #ifndef BOOST_GEOMETRY_GEOMETRIES_CONCEPTS_CHECK_HPP
20 #define BOOST_GEOMETRY_GEOMETRIES_CONCEPTS_CHECK_HPP
23 #include <type_traits>
25 #include <boost/concept_check.hpp>
26 #include <boost/concept/requires.hpp>
27 #include <boost/core/ignore_unused.hpp>
28 #include <boost/variant/variant_fwd.hpp>
30 #include <boost/geometry/core/tag.hpp>
31 #include <boost/geometry/core/tags.hpp>
33 #include <boost/geometry/geometries/concepts/box_concept.hpp>
34 #include <boost/geometry/geometries/concepts/linestring_concept.hpp>
35 #include <boost/geometry/geometries/concepts/multi_point_concept.hpp>
36 #include <boost/geometry/geometries/concepts/multi_linestring_concept.hpp>
37 #include <boost/geometry/geometries/concepts/multi_polygon_concept.hpp>
38 #include <boost/geometry/geometries/concepts/point_concept.hpp>
39 #include <boost/geometry/geometries/concepts/polygon_concept.hpp>
40 #include <boost/geometry/geometries/concepts/ring_concept.hpp>
41 #include <boost/geometry/geometries/concepts/segment_concept.hpp>
43 #include <boost/geometry/algorithms/not_implemented.hpp>
45 namespace boost { namespace geometry
49 #ifndef DOXYGEN_NO_DETAIL
50 namespace detail { namespace concept_check
53 template <typename Concept>
56 BOOST_CONCEPT_ASSERT((Concept ));
59 }} // namespace detail::concept_check
60 #endif // DOXYGEN_NO_DETAIL
64 #ifndef DOXYGEN_NO_DISPATCH
71 typename GeometryTag = typename geometry::tag<Geometry>::type,
72 bool IsConst = std::is_const<Geometry>::type::value
74 struct check : not_implemented<GeometryTag>
78 template <typename Geometry>
79 struct check<Geometry, point_tag, true>
80 : detail::concept_check::check<concepts::ConstPoint<Geometry> >
84 template <typename Geometry>
85 struct check<Geometry, point_tag, false>
86 : detail::concept_check::check<concepts::Point<Geometry> >
90 template <typename Geometry>
91 struct check<Geometry, linestring_tag, true>
92 : detail::concept_check::check<concepts::ConstLinestring<Geometry> >
96 template <typename Geometry>
97 struct check<Geometry, linestring_tag, false>
98 : detail::concept_check::check<concepts::Linestring<Geometry> >
102 template <typename Geometry>
103 struct check<Geometry, ring_tag, true>
104 : detail::concept_check::check<concepts::ConstRing<Geometry> >
108 template <typename Geometry>
109 struct check<Geometry, ring_tag, false>
110 : detail::concept_check::check<concepts::Ring<Geometry> >
113 template <typename Geometry>
114 struct check<Geometry, polygon_tag, true>
115 : detail::concept_check::check<concepts::ConstPolygon<Geometry> >
119 template <typename Geometry>
120 struct check<Geometry, polygon_tag, false>
121 : detail::concept_check::check<concepts::Polygon<Geometry> >
125 template <typename Geometry>
126 struct check<Geometry, box_tag, true>
127 : detail::concept_check::check<concepts::ConstBox<Geometry> >
131 template <typename Geometry>
132 struct check<Geometry, box_tag, false>
133 : detail::concept_check::check<concepts::Box<Geometry> >
137 template <typename Geometry>
138 struct check<Geometry, segment_tag, true>
139 : detail::concept_check::check<concepts::ConstSegment<Geometry> >
143 template <typename Geometry>
144 struct check<Geometry, segment_tag, false>
145 : detail::concept_check::check<concepts::Segment<Geometry> >
149 template <typename Geometry>
150 struct check<Geometry, multi_point_tag, true>
151 : detail::concept_check::check<concepts::ConstMultiPoint<Geometry> >
155 template <typename Geometry>
156 struct check<Geometry, multi_point_tag, false>
157 : detail::concept_check::check<concepts::MultiPoint<Geometry> >
161 template <typename Geometry>
162 struct check<Geometry, multi_linestring_tag, true>
163 : detail::concept_check::check<concepts::ConstMultiLinestring<Geometry> >
167 template <typename Geometry>
168 struct check<Geometry, multi_linestring_tag, false>
169 : detail::concept_check::check<concepts::MultiLinestring<Geometry> >
173 template <typename Geometry>
174 struct check<Geometry, multi_polygon_tag, true>
175 : detail::concept_check::check<concepts::ConstMultiPolygon<Geometry> >
179 template <typename Geometry>
180 struct check<Geometry, multi_polygon_tag, false>
181 : detail::concept_check::check<concepts::MultiPolygon<Geometry> >
185 } // namespace dispatch
195 #ifndef DOXYGEN_NO_DETAIL
200 template <typename Geometry>
201 struct checker : dispatch::check<Geometry>
204 template <BOOST_VARIANT_ENUM_PARAMS(typename T)>
205 struct checker<boost::variant<BOOST_VARIANT_ENUM_PARAMS(T)> >
208 template <BOOST_VARIANT_ENUM_PARAMS(typename T)>
209 struct checker<boost::variant<BOOST_VARIANT_ENUM_PARAMS(T)> const>
214 #endif // DOXYGEN_NO_DETAIL
218 \brief Checks, in compile-time, the concept of any geometry
221 template <typename Geometry>
222 // workaround for VS2015
223 #if !defined(_MSC_VER) || (_MSC_VER >= 1910)
228 detail::checker<Geometry> c;
229 boost::ignore_unused(c);
234 \brief Checks, in compile-time, the concept of two geometries, and if they
235 have equal dimensions
238 template <typename Geometry1, typename Geometry2>
239 // workaround for VS2015
240 #if !defined(_MSC_VER) || (_MSC_VER >= 1910)
243 inline void check_concepts_and_equal_dimensions()
247 assert_dimension_equal<Geometry1, Geometry2>();
251 } // namespace concepts
254 }} // namespace boost::geometry
257 #endif // BOOST_GEOMETRY_GEOMETRIES_CONCEPTS_CHECK_HPP