Back to home page

EIC code displayed by LXR

 
 

    


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

0001 // Boost.Geometry (aka GGL, Generic Geometry Library)
0002 
0003 // Copyright (c) 2023 Adam Wulkiewicz, Lodz, Poland.
0004 
0005 // Copyright (c) 2015, Oracle and/or its affiliates.
0006 // Contributed and/or modified by Menelaos Karavelas, on behalf of Oracle
0007 
0008 // Licensed under the Boost Software License version 1.0.
0009 // http://www.boost.org/users/license.html
0010 
0011 #ifndef BOOST_GEOMETRY_ALGORITHMS_DETAIL_SWEEP_HPP
0012 #define BOOST_GEOMETRY_ALGORITHMS_DETAIL_SWEEP_HPP
0013 
0014 #include <boost/geometry/util/condition.hpp>
0015 
0016 #include <boost/core/ignore_unused.hpp>
0017 
0018 
0019 namespace boost { namespace geometry
0020 {
0021 
0022 #ifndef DOXYGEN_NO_DETAIL
0023 namespace detail { namespace sweep
0024 {
0025 
0026 struct no_interrupt_policy
0027 {
0028     static bool const enabled = false;
0029 
0030     template <typename Event>
0031     static inline bool apply(Event const&)
0032     {
0033         return false;
0034     }
0035 };
0036 
0037 }} // namespace detail::sweep
0038 #endif // DOXYGEN_NO_DETAIL
0039 
0040 
0041 template
0042 <
0043     typename Range,
0044     typename PriorityQueue,
0045     typename InitializationVisitor,
0046     typename EventVisitor,
0047     typename InterruptPolicy
0048 >
0049 inline void sweep(Range const& range, PriorityQueue& queue,
0050                   InitializationVisitor& initialization_visitor,
0051                   EventVisitor& event_visitor,
0052                   InterruptPolicy const& interrupt_policy)
0053 {
0054     typedef typename PriorityQueue::value_type event_type;
0055 
0056     initialization_visitor.apply(range, queue, event_visitor);
0057     while (! queue.empty())
0058     {
0059         event_type event = queue.top();
0060         queue.pop();
0061         event_visitor.apply(event, queue);
0062         if (BOOST_GEOMETRY_CONDITION(interrupt_policy.enabled) && interrupt_policy.apply(event))
0063         {
0064             break;
0065         }
0066     }
0067 
0068     boost::ignore_unused(interrupt_policy);
0069 }
0070 
0071 
0072 template
0073 <
0074     typename Range,
0075     typename PriorityQueue,
0076     typename InitializationVisitor,
0077     typename EventVisitor
0078 >
0079 inline void sweep(Range const& range, PriorityQueue& queue,
0080                   InitializationVisitor& initialization_visitor,
0081                   EventVisitor& event_visitor)
0082 {
0083     sweep(range, queue, initialization_visitor, event_visitor,
0084           detail::sweep::no_interrupt_policy());
0085 }
0086 
0087 
0088 }} // namespace boost::geometry
0089 
0090 #endif // BOOST_GEOMETRY_ALGORITHMS_DETAIL_SWEEP_HPP