relate_impl.hpp 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109
  1. // Boost.Geometry (aka GGL, Generic Geometry Library)
  2. // Copyright (c) 2007-2012 Barend Gehrels, Amsterdam, the Netherlands.
  3. // This file was modified by Oracle on 2013-2020.
  4. // Modifications copyright (c) 2013-2020 Oracle and/or its affiliates.
  5. // Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
  6. // Use, modification and distribution is subject to the Boost Software License,
  7. // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
  8. // http://www.boost.org/LICENSE_1_0.txt)
  9. #ifndef BOOST_GEOMETRY_ALGORITHMS_DETAIL_RELATE_RELATE_IMPL_HPP
  10. #define BOOST_GEOMETRY_ALGORITHMS_DETAIL_RELATE_RELATE_IMPL_HPP
  11. #include <type_traits>
  12. #include <boost/geometry/algorithms/detail/relate/interface.hpp>
  13. #include <boost/geometry/algorithms/not_implemented.hpp>
  14. #include <boost/geometry/core/tag.hpp>
  15. namespace boost { namespace geometry {
  16. #ifndef DOXYGEN_NO_DETAIL
  17. namespace detail { namespace relate {
  18. struct implemented_tag {};
  19. template
  20. <
  21. typename Geometry1,
  22. typename Geometry2
  23. >
  24. struct relate_impl_base
  25. : std::conditional_t
  26. <
  27. std::is_base_of
  28. <
  29. nyi::not_implemented_tag,
  30. dispatch::relate<Geometry1, Geometry2>
  31. >::value,
  32. not_implemented
  33. <
  34. typename geometry::tag<Geometry1>::type,
  35. typename geometry::tag<Geometry2>::type
  36. >,
  37. implemented_tag
  38. >
  39. {};
  40. template
  41. <
  42. typename Geometry1,
  43. typename Geometry2,
  44. typename StaticMask
  45. >
  46. struct relate_impl_dispatch
  47. : relate_impl_base<Geometry1, Geometry2>
  48. {
  49. template <typename Strategy>
  50. static inline bool apply(Geometry1 const& g1, Geometry2 const& g2, Strategy const& strategy)
  51. {
  52. typename detail::relate::result_handler_type
  53. <
  54. Geometry1,
  55. Geometry2,
  56. StaticMask
  57. >::type handler;
  58. dispatch::relate<Geometry1, Geometry2>::apply(g1, g2, handler, strategy);
  59. return handler.result();
  60. }
  61. };
  62. template <typename Geometry1, typename Geometry2>
  63. struct relate_impl_dispatch<Geometry1, Geometry2, detail::relate::false_mask>
  64. : relate_impl_base<Geometry1, Geometry2>
  65. {
  66. template <typename Strategy>
  67. static inline bool apply(Geometry1 const& , Geometry2 const& , Strategy const& )
  68. {
  69. return false;
  70. }
  71. };
  72. template
  73. <
  74. template <typename, typename> class StaticMaskTrait,
  75. typename Geometry1,
  76. typename Geometry2
  77. >
  78. struct relate_impl
  79. : relate_impl_dispatch
  80. <
  81. Geometry1,
  82. Geometry2,
  83. typename StaticMaskTrait<Geometry1, Geometry2>::type
  84. >
  85. {};
  86. }} // namespace detail::relate
  87. #endif // DOXYGEN_NO_DETAIL
  88. }} // namespace boost::geometry
  89. #endif // BOOST_GEOMETRY_ALGORITHMS_DETAIL_RELATE_RELATE_IMPL_HPP