Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:35:36

0001 // Boost.Geometry (aka GGL, Generic Geometry Library)
0002 
0003 // Copyright (c) 2015, Oracle and/or its affiliates.
0004 
0005 // Contributed and/or modified by Menelaos Karavelas, on behalf of Oracle
0006 
0007 // Licensed under the Boost Software License version 1.0.
0008 // http://www.boost.org/users/license.html
0009 
0010 #ifndef BOOST_GEOMETRY_POLICIES_IS_VALID_DEFAULT_POLICY_HPP
0011 #define BOOST_GEOMETRY_POLICIES_IS_VALID_DEFAULT_POLICY_HPP
0012 
0013 #include <boost/geometry/algorithms/validity_failure_type.hpp>
0014 
0015 
0016 namespace boost { namespace geometry
0017 {
0018 
0019 
0020 template <bool AllowDuplicates = true, bool AllowSpikes = true>
0021 class is_valid_default_policy
0022 {
0023 protected:
0024     static inline bool is_valid(validity_failure_type failure)
0025     {
0026         return failure == no_failure
0027             || (AllowDuplicates && failure == failure_duplicate_points);
0028     }
0029 
0030     static inline bool is_valid(validity_failure_type failure, bool is_linear)
0031     {
0032         return is_valid(failure)
0033             || (is_linear && AllowSpikes && failure == failure_spikes);
0034     }
0035 
0036 public:
0037     template <validity_failure_type Failure>
0038     static inline bool apply()
0039     {
0040         return is_valid(Failure);
0041     }
0042 
0043     template <validity_failure_type Failure, typename Data>
0044     static inline bool apply(Data const&)
0045     {
0046         return is_valid(Failure);
0047     }
0048 
0049     template <validity_failure_type Failure, typename Data1, typename Data2>
0050     static inline bool apply(Data1 const& data1, Data2 const&)
0051     {
0052         return is_valid(Failure, data1);
0053     }
0054 };
0055 
0056 
0057 }} // namespace boost::geometry
0058 
0059 #endif // BOOST_GEOMETRY_POLICIES_IS_VALID_DEFAULT_POLICY_HPP