]> git.proxmox.com Git - ceph.git/blame - ceph/src/boost/libs/geometry/include/boost/geometry/policies/predicate_based_interrupt_policy.hpp
bump version to 12.2.2-pve1
[ceph.git] / ceph / src / boost / libs / geometry / include / boost / geometry / policies / predicate_based_interrupt_policy.hpp
CommitLineData
7c673cae
FG
1// Boost.Geometry (aka GGL, Generic Geometry Library)
2
3// Copyright (c) 2014, Oracle and/or its affiliates.
4
5// Contributed and/or modified by Menelaos Karavelas, on behalf of Oracle
6
7// Licensed under the Boost Software License version 1.0.
8// http://www.boost.org/users/license.html
9
10#ifndef BOOST_GEOMETRY_ALGORITHMS_POLICIES_PREDICATE_BASED_INTERRUPT_POLICY_HPP
11#define BOOST_GEOMETRY_ALGORITHMS_POLICIES_PREDICATE_BASED_INTERRUPT_POLICY_HPP
12
13#include <boost/range.hpp>
14
15#include <boost/geometry/algorithms/detail/check_iterator_range.hpp>
16
17
18namespace boost { namespace geometry
19{
20
21
22#ifndef DOXYGEN_NO_DETAIL
23namespace detail { namespace overlay
24{
25
26
27template
28<
29 typename IsAcceptableTurnPredicate,
30 bool AllowEmptyTurnRange = true // by default, allow an empty turn range
31>
32struct stateless_predicate_based_interrupt_policy
33{
34 static bool const enabled = true;
35 bool has_intersections; // set to true if there is at least one
36 // unacceptable turn
37
38 inline stateless_predicate_based_interrupt_policy()
39 : has_intersections(false)
40 {}
41
42 template <typename Range>
43 inline bool apply(Range const& range)
44 {
45 // if there is at least one unacceptable turn in the range, return false
46 has_intersections = !detail::check_iterator_range
47 <
48 IsAcceptableTurnPredicate,
49 AllowEmptyTurnRange
50 >::apply(boost::begin(range), boost::end(range));
51
52 return has_intersections;
53 }
54};
55
56
57
58
59template
60<
61 typename IsAcceptableTurnPredicate,
62 bool AllowEmptyTurnRange = true // by default, allow an empty turn range
63>
64struct predicate_based_interrupt_policy
65{
66 static bool const enabled = true;
67 bool has_intersections; // set to true if there is at least one
68 // unacceptable turn
69 IsAcceptableTurnPredicate const& m_predicate;
70
71 inline
72 predicate_based_interrupt_policy(IsAcceptableTurnPredicate const& predicate)
73 : has_intersections(false)
74 , m_predicate(predicate)
75 {}
76
77 template <typename Range>
78 inline bool apply(Range const& range)
79 {
80 // if there is at least one unacceptable turn in the range, return false
81 has_intersections = !detail::check_iterator_range
82 <
83 IsAcceptableTurnPredicate,
84 AllowEmptyTurnRange
85 >::apply(boost::begin(range), boost::end(range), m_predicate);
86
87 return has_intersections;
88 }
89};
90
91
92
93
94}} // namespace detail::overlay
95#endif // DOXYGEN_NO_DETAIL
96
97
98}} // namespace boost::geometry
99
100
101#endif // BOOST_GEOMETRY_ALGORITHMS_POLICIES_PREDICATE_BASED_INTERRUPT_POLICY_HPP