Back to home page

EIC code displayed by LXR

 
 

    


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

0001 // Boost.Geometry (aka GGL, Generic Geometry Library)
0002 
0003 // Copyright (c) 2007-2012 Barend Gehrels, Amsterdam, the Netherlands.
0004 
0005 // Use, modification and distribution is subject to the Boost Software License,
0006 // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
0007 // http://www.boost.org/LICENSE_1_0.txt)
0008 
0009 #ifndef BOOST_GEOMETRY_ALGORITHMS_DETAIL_OVERLAY_VISIT_INFO_HPP
0010 #define BOOST_GEOMETRY_ALGORITHMS_DETAIL_OVERLAY_VISIT_INFO_HPP
0011 
0012 
0013 namespace boost { namespace geometry
0014 {
0015 
0016 #ifndef DOXYGEN_NO_DETAIL
0017 namespace detail { namespace overlay
0018 {
0019 
0020 class visit_info
0021 {
0022 private :
0023     static const int NONE = 0;
0024     static const int STARTED = 1;
0025     static const int VISITED = 2;
0026     static const int FINISHED = 3;
0027     static const int REJECTED = 4;
0028 
0029     int m_visit_code;
0030     bool m_rejected;
0031     bool m_final;
0032 
0033 public:
0034     inline visit_info()
0035         : m_visit_code(0)
0036         , m_rejected(false)
0037         , m_final(false)
0038     {}
0039 
0040     inline void set_visited() { m_visit_code = VISITED; }
0041     inline void set_started() { m_visit_code = STARTED; }
0042     inline void set_finished() { m_visit_code = FINISHED; }
0043     inline void set_rejected()
0044     {
0045         m_visit_code = REJECTED;
0046         m_rejected = true;
0047     }
0048 
0049     inline bool none() const { return m_visit_code == NONE; }
0050     inline bool visited() const { return m_visit_code == VISITED; }
0051     inline bool started() const { return m_visit_code == STARTED; }
0052     inline bool finished() const { return m_visit_code == FINISHED; }
0053     inline bool rejected() const { return m_rejected; }
0054     inline bool finalized() const { return m_final; }
0055 
0056     inline void clear()
0057     {
0058         if (! m_rejected && ! m_final)
0059         {
0060             m_visit_code = NONE;
0061         }
0062     }
0063 
0064     inline void reset()
0065     {
0066         *this = visit_info();
0067     }
0068 
0069     inline void finalize()
0070     {
0071         if (visited() || started() || finished() )
0072         {
0073             m_final = true;
0074         }
0075     }
0076 
0077 #ifdef BOOST_GEOMETRY_DEBUG_INTERSECTION
0078     friend std::ostream& operator<<(std::ostream &os, visit_info const& v)
0079     {
0080         if (v.m_visit_code != 0)
0081         {
0082             os << " VIS: " << int(v.m_visit_code);
0083         }
0084         return os;
0085     }
0086 #endif
0087 
0088 };
0089 
0090 
0091 }} // namespace detail::overlay
0092 #endif //DOXYGEN_NO_DETAIL
0093 
0094 
0095 }} // namespace boost::geometry
0096 
0097 
0098 #endif // BOOST_GEOMETRY_ALGORITHMS_DETAIL_OVERLAY_VISIT_INFO_HPP