]> git.proxmox.com Git - ceph.git/blame - ceph/src/boost/libs/geometry/include/boost/geometry/policies/is_valid/default_policy.hpp
bump version to 12.2.2-pve1
[ceph.git] / ceph / src / boost / libs / geometry / include / boost / geometry / policies / is_valid / default_policy.hpp
CommitLineData
7c673cae
FG
1// Boost.Geometry (aka GGL, Generic Geometry Library)
2
3// Copyright (c) 2015, 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_POLICIES_IS_VALID_DEFAULT_POLICY_HPP
11#define BOOST_GEOMETRY_POLICIES_IS_VALID_DEFAULT_POLICY_HPP
12
13#include <boost/geometry/algorithms/validity_failure_type.hpp>
14
15
16namespace boost { namespace geometry
17{
18
19
20template <bool AllowDuplicates = true, bool AllowSpikes = true>
21class is_valid_default_policy
22{
23protected:
24 static inline bool is_valid(validity_failure_type failure)
25 {
26 return failure == no_failure
27 || (AllowDuplicates && failure == failure_duplicate_points);
28 }
29
30 static inline bool is_valid(validity_failure_type failure, bool is_linear)
31 {
32 return is_valid(failure)
33 || (is_linear && AllowSpikes && failure == failure_spikes);
34 }
35
36public:
37 template <validity_failure_type Failure>
38 static inline bool apply()
39 {
40 return is_valid(Failure);
41 }
42
43 template <validity_failure_type Failure, typename Data>
44 static inline bool apply(Data const&)
45 {
46 return is_valid(Failure);
47 }
48
49 template <validity_failure_type Failure, typename Data1, typename Data2>
50 static inline bool apply(Data1 const& data1, Data2 const&)
51 {
52 return is_valid(Failure, data1);
53 }
54};
55
56
57}} // namespace boost::geometry
58
59#endif // BOOST_GEOMETRY_POLICIES_IS_VALID_DEFAULT_POLICY_HPP