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