123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257 |
- #ifndef BOOST_GEOMETRY_GEOMETRIES_CONCEPTS_CHECK_HPP
- #define BOOST_GEOMETRY_GEOMETRIES_CONCEPTS_CHECK_HPP
- #include <type_traits>
- #include <boost/concept_check.hpp>
- #include <boost/concept/requires.hpp>
- #include <boost/core/ignore_unused.hpp>
- #include <boost/variant/variant_fwd.hpp>
- #include <boost/geometry/core/tag.hpp>
- #include <boost/geometry/core/tags.hpp>
- #include <boost/geometry/geometries/concepts/box_concept.hpp>
- #include <boost/geometry/geometries/concepts/linestring_concept.hpp>
- #include <boost/geometry/geometries/concepts/multi_point_concept.hpp>
- #include <boost/geometry/geometries/concepts/multi_linestring_concept.hpp>
- #include <boost/geometry/geometries/concepts/multi_polygon_concept.hpp>
- #include <boost/geometry/geometries/concepts/point_concept.hpp>
- #include <boost/geometry/geometries/concepts/polygon_concept.hpp>
- #include <boost/geometry/geometries/concepts/ring_concept.hpp>
- #include <boost/geometry/geometries/concepts/segment_concept.hpp>
- #include <boost/geometry/algorithms/not_implemented.hpp>
- namespace boost { namespace geometry
- {
- #ifndef DOXYGEN_NO_DETAIL
- namespace detail { namespace concept_check
- {
- template <typename Concept>
- class check
- {
- BOOST_CONCEPT_ASSERT((Concept ));
- };
- }}
- #endif
- #ifndef DOXYGEN_NO_DISPATCH
- namespace dispatch
- {
- template
- <
- typename Geometry,
- typename GeometryTag = typename geometry::tag<Geometry>::type,
- bool IsConst = std::is_const<Geometry>::type::value
- >
- struct check : not_implemented<GeometryTag>
- {};
- template <typename Geometry>
- struct check<Geometry, point_tag, true>
- : detail::concept_check::check<concepts::ConstPoint<Geometry> >
- {};
- template <typename Geometry>
- struct check<Geometry, point_tag, false>
- : detail::concept_check::check<concepts::Point<Geometry> >
- {};
- template <typename Geometry>
- struct check<Geometry, linestring_tag, true>
- : detail::concept_check::check<concepts::ConstLinestring<Geometry> >
- {};
- template <typename Geometry>
- struct check<Geometry, linestring_tag, false>
- : detail::concept_check::check<concepts::Linestring<Geometry> >
- {};
- template <typename Geometry>
- struct check<Geometry, ring_tag, true>
- : detail::concept_check::check<concepts::ConstRing<Geometry> >
- {};
- template <typename Geometry>
- struct check<Geometry, ring_tag, false>
- : detail::concept_check::check<concepts::Ring<Geometry> >
- {};
- template <typename Geometry>
- struct check<Geometry, polygon_tag, true>
- : detail::concept_check::check<concepts::ConstPolygon<Geometry> >
- {};
- template <typename Geometry>
- struct check<Geometry, polygon_tag, false>
- : detail::concept_check::check<concepts::Polygon<Geometry> >
- {};
- template <typename Geometry>
- struct check<Geometry, box_tag, true>
- : detail::concept_check::check<concepts::ConstBox<Geometry> >
- {};
- template <typename Geometry>
- struct check<Geometry, box_tag, false>
- : detail::concept_check::check<concepts::Box<Geometry> >
- {};
- template <typename Geometry>
- struct check<Geometry, segment_tag, true>
- : detail::concept_check::check<concepts::ConstSegment<Geometry> >
- {};
- template <typename Geometry>
- struct check<Geometry, segment_tag, false>
- : detail::concept_check::check<concepts::Segment<Geometry> >
- {};
- template <typename Geometry>
- struct check<Geometry, multi_point_tag, true>
- : detail::concept_check::check<concepts::ConstMultiPoint<Geometry> >
- {};
- template <typename Geometry>
- struct check<Geometry, multi_point_tag, false>
- : detail::concept_check::check<concepts::MultiPoint<Geometry> >
- {};
- template <typename Geometry>
- struct check<Geometry, multi_linestring_tag, true>
- : detail::concept_check::check<concepts::ConstMultiLinestring<Geometry> >
- {};
- template <typename Geometry>
- struct check<Geometry, multi_linestring_tag, false>
- : detail::concept_check::check<concepts::MultiLinestring<Geometry> >
- {};
- template <typename Geometry>
- struct check<Geometry, multi_polygon_tag, true>
- : detail::concept_check::check<concepts::ConstMultiPolygon<Geometry> >
- {};
- template <typename Geometry>
- struct check<Geometry, multi_polygon_tag, false>
- : detail::concept_check::check<concepts::MultiPolygon<Geometry> >
- {};
- }
- #endif
- namespace concepts
- {
- #ifndef DOXYGEN_NO_DETAIL
- namespace detail
- {
- template <typename Geometry>
- struct checker : dispatch::check<Geometry>
- {};
- template <BOOST_VARIANT_ENUM_PARAMS(typename T)>
- struct checker<boost::variant<BOOST_VARIANT_ENUM_PARAMS(T)> >
- {};
- template <BOOST_VARIANT_ENUM_PARAMS(typename T)>
- struct checker<boost::variant<BOOST_VARIANT_ENUM_PARAMS(T)> const>
- {};
- }
- #endif
- template <typename Geometry>
- #if !defined(_MSC_VER) || (_MSC_VER >= 1910)
- constexpr
- #endif
- inline void check()
- {
- detail::checker<Geometry> c;
- boost::ignore_unused(c);
- }
- template <typename Geometry1, typename Geometry2>
- #if !defined(_MSC_VER) || (_MSC_VER >= 1910)
- constexpr
- #endif
- inline void check_concepts_and_equal_dimensions()
- {
- check<Geometry1>();
- check<Geometry2>();
- assert_dimension_equal<Geometry1, Geometry2>();
- }
- }
- }}
- #endif
|