relate_impl.hpp 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111
  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, 2014, 2015, 2019.
  4. // Modifications copyright (c) 2013-2019 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 <boost/mpl/if.hpp>
  12. #include <boost/mpl/or.hpp>
  13. #include <boost/type_traits/is_base_of.hpp>
  14. #include <boost/geometry/algorithms/detail/relate/interface.hpp>
  15. #include <boost/geometry/algorithms/not_implemented.hpp>
  16. #include <boost/geometry/core/tag.hpp>
  17. namespace boost { namespace geometry {
  18. #ifndef DOXYGEN_NO_DETAIL
  19. namespace detail { namespace relate {
  20. struct implemented_tag {};
  21. template
  22. <
  23. typename Geometry1,
  24. typename Geometry2
  25. >
  26. struct relate_impl_base
  27. : boost::mpl::if_c
  28. <
  29. boost::is_base_of
  30. <
  31. nyi::not_implemented_tag,
  32. dispatch::relate<Geometry1, Geometry2>
  33. >::value,
  34. not_implemented
  35. <
  36. typename geometry::tag<Geometry1>::type,
  37. typename geometry::tag<Geometry2>::type
  38. >,
  39. implemented_tag
  40. >::type
  41. {};
  42. template
  43. <
  44. typename Geometry1,
  45. typename Geometry2,
  46. typename StaticMask
  47. >
  48. struct relate_impl_dispatch
  49. : relate_impl_base<Geometry1, Geometry2>
  50. {
  51. template <typename Strategy>
  52. static inline bool apply(Geometry1 const& g1, Geometry2 const& g2, Strategy const& strategy)
  53. {
  54. typename detail::relate::result_handler_type
  55. <
  56. Geometry1,
  57. Geometry2,
  58. StaticMask
  59. >::type handler;
  60. dispatch::relate<Geometry1, Geometry2>::apply(g1, g2, handler, strategy);
  61. return handler.result();
  62. }
  63. };
  64. template <typename Geometry1, typename Geometry2>
  65. struct relate_impl_dispatch<Geometry1, Geometry2, detail::relate::false_mask>
  66. : relate_impl_base<Geometry1, Geometry2>
  67. {
  68. template <typename Strategy>
  69. static inline bool apply(Geometry1 const& , Geometry2 const& , Strategy const& )
  70. {
  71. return false;
  72. }
  73. };
  74. template
  75. <
  76. template <typename, typename> class StaticMaskTrait,
  77. typename Geometry1,
  78. typename Geometry2
  79. >
  80. struct relate_impl
  81. : relate_impl_dispatch
  82. <
  83. Geometry1,
  84. Geometry2,
  85. typename StaticMaskTrait<Geometry1, Geometry2>::type
  86. >
  87. {};
  88. }} // namespace detail::relate
  89. #endif // DOXYGEN_NO_DETAIL
  90. }} // namespace boost::geometry
  91. #endif // BOOST_GEOMETRY_ALGORITHMS_DETAIL_RELATE_RELATE_IMPL_HPP