1 // Boost.Geometry (aka GGL, Generic Geometry Library)
2 
3 // Copyright (c) 2007-2012 Barend Gehrels, Amsterdam, the Netherlands.
4 
5 // This file was modified by Oracle on 2013, 2014, 2015.
6 // Modifications copyright (c) 2013-2015 Oracle and/or its affiliates.
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 
33 template <template <typename, typename> class StaticMaskTrait,
34           typename Geometry1,
35           typename Geometry2>
36 struct relate_impl
37     : boost::mpl::if_
38         <
39             boost::mpl::or_
40                 <
41                     boost::is_base_of
42                         <
43                             nyi::not_implemented_tag,
44                             StaticMaskTrait<Geometry1, Geometry2>
45                         >,
46                     boost::is_base_of
47                         <
48                             nyi::not_implemented_tag,
49                             dispatch::relate<Geometry1, Geometry2>
50                         >
51                 >,
52             not_implemented
53                 <
54                     typename geometry::tag<Geometry1>::type,
55                     typename geometry::tag<Geometry2>::type
56                 >,
57             implemented_tag
58         >::type
59 {
60     template <typename Strategy>
applyboost::geometry::detail::relate::relate_impl61     static inline bool apply(Geometry1 const& g1, Geometry2 const& g2, Strategy const& strategy)
62     {
63         typename detail::relate::result_handler_type
64             <
65                 Geometry1,
66                 Geometry2,
67                 typename StaticMaskTrait<Geometry1, Geometry2>::type
68             >::type handler;
69 
70         dispatch::relate<Geometry1, Geometry2>::apply(g1, g2, handler, strategy);
71 
72         return handler.result();
73     }
74 };
75 
76 }} // namespace detail::relate
77 #endif // DOXYGEN_NO_DETAIL
78 
79 }} // namespace boost::geometry
80 
81 #endif // BOOST_GEOMETRY_ALGORITHMS_DETAIL_RELATE_RELATE_IMPL_HPP
82