]> git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/geometry/include/boost/geometry/algorithms/detail/overlay/visit_info.hpp
bump version to 12.2.2-pve1
[ceph.git] / ceph / src / boost / libs / geometry / include / boost / geometry / algorithms / detail / overlay / visit_info.hpp
1 // Boost.Geometry (aka GGL, Generic Geometry Library)
2
3 // Copyright (c) 2007-2012 Barend Gehrels, Amsterdam, the Netherlands.
4
5 // Use, modification and distribution is subject to the Boost Software License,
6 // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
7 // http://www.boost.org/LICENSE_1_0.txt)
8
9 #ifndef BOOST_GEOMETRY_ALGORITHMS_DETAIL_OVERLAY_VISIT_INFO_HPP
10 #define BOOST_GEOMETRY_ALGORITHMS_DETAIL_OVERLAY_VISIT_INFO_HPP
11
12
13 namespace boost { namespace geometry
14 {
15
16 #ifndef DOXYGEN_NO_DETAIL
17 namespace detail { namespace overlay
18 {
19
20 class visit_info
21 {
22 private :
23 static const int NONE = 0;
24 static const int STARTED = 1;
25 static const int VISITED = 2;
26 static const int FINISHED = 3;
27 static const int REJECTED = 4;
28
29 int m_visit_code;
30 bool m_rejected;
31 bool m_final;
32
33 public:
34 inline visit_info()
35 : m_visit_code(0)
36 , m_rejected(false)
37 , m_final(false)
38 {}
39
40 inline void set_visited() { m_visit_code = VISITED; }
41 inline void set_started() { m_visit_code = STARTED; }
42 inline void set_finished() { m_visit_code = FINISHED; }
43 inline void set_rejected()
44 {
45 m_visit_code = REJECTED;
46 m_rejected = true;
47 }
48
49 inline bool none() const { return m_visit_code == NONE; }
50 inline bool visited() const { return m_visit_code == VISITED; }
51 inline bool started() const { return m_visit_code == STARTED; }
52 inline bool finished() const { return m_visit_code == FINISHED; }
53 inline bool rejected() const { return m_rejected; }
54 inline bool finalized() const { return m_final; }
55
56 inline void clear()
57 {
58 if (! m_rejected && ! m_final)
59 {
60 m_visit_code = NONE;
61 }
62 }
63
64 inline void reset()
65 {
66 *this = visit_info();
67 }
68
69 inline void finalize()
70 {
71 if (visited() || started() || finished() )
72 {
73 m_final = true;
74 }
75 }
76
77 #ifdef BOOST_GEOMETRY_DEBUG_INTERSECTION
78 friend std::ostream& operator<<(std::ostream &os, visit_info const& v)
79 {
80 if (v.m_visit_code != 0)
81 {
82 os << " VIS: " << int(v.m_visit_code);
83 }
84 return os;
85 }
86 #endif
87
88 };
89
90
91 }} // namespace detail::overlay
92 #endif //DOXYGEN_NO_DETAIL
93
94
95 }} // namespace boost::geometry
96
97
98 #endif // BOOST_GEOMETRY_ALGORITHMS_DETAIL_OVERLAY_VISIT_INFO_HPP