Chris@16
|
1 // Boost.Geometry (aka GGL, Generic Geometry Library)
|
Chris@16
|
2
|
Chris@16
|
3 // Copyright (c) 2007-2012 Barend Gehrels, Amsterdam, the Netherlands.
|
Chris@16
|
4
|
Chris@16
|
5 // Use, modification and distribution is subject to the Boost Software License,
|
Chris@16
|
6 // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
|
Chris@16
|
7 // http://www.boost.org/LICENSE_1_0.txt)
|
Chris@16
|
8
|
Chris@16
|
9 #ifndef BOOST_GEOMETRY_ALGORITHMS_DETAIL_RING_IDENTIFIER_HPP
|
Chris@16
|
10 #define BOOST_GEOMETRY_ALGORITHMS_DETAIL_RING_IDENTIFIER_HPP
|
Chris@16
|
11
|
Chris@16
|
12
|
Chris@101
|
13 #if defined(BOOST_GEOMETRY_DEBUG_IDENTIFIER)
|
Chris@101
|
14 #include <iostream>
|
Chris@101
|
15 #endif
|
Chris@101
|
16
|
Chris@101
|
17
|
Chris@101
|
18 #include <boost/geometry/algorithms/detail/signed_index_type.hpp>
|
Chris@101
|
19
|
Chris@101
|
20
|
Chris@16
|
21 namespace boost { namespace geometry
|
Chris@16
|
22 {
|
Chris@16
|
23
|
Chris@16
|
24
|
Chris@16
|
25 // Ring Identifier. It is currently: source,multi,ring
|
Chris@16
|
26 struct ring_identifier
|
Chris@16
|
27 {
|
Chris@16
|
28
|
Chris@16
|
29 inline ring_identifier()
|
Chris@16
|
30 : source_index(-1)
|
Chris@16
|
31 , multi_index(-1)
|
Chris@16
|
32 , ring_index(-1)
|
Chris@16
|
33 {}
|
Chris@16
|
34
|
Chris@101
|
35 inline ring_identifier(signed_index_type src,
|
Chris@101
|
36 signed_index_type mul,
|
Chris@101
|
37 signed_index_type rin)
|
Chris@16
|
38 : source_index(src)
|
Chris@16
|
39 , multi_index(mul)
|
Chris@16
|
40 , ring_index(rin)
|
Chris@16
|
41 {}
|
Chris@16
|
42
|
Chris@16
|
43 inline bool operator<(ring_identifier const& other) const
|
Chris@16
|
44 {
|
Chris@16
|
45 return source_index != other.source_index ? source_index < other.source_index
|
Chris@16
|
46 : multi_index !=other.multi_index ? multi_index < other.multi_index
|
Chris@16
|
47 : ring_index < other.ring_index
|
Chris@16
|
48 ;
|
Chris@16
|
49 }
|
Chris@16
|
50
|
Chris@16
|
51 inline bool operator==(ring_identifier const& other) const
|
Chris@16
|
52 {
|
Chris@16
|
53 return source_index == other.source_index
|
Chris@16
|
54 && ring_index == other.ring_index
|
Chris@16
|
55 && multi_index == other.multi_index
|
Chris@16
|
56 ;
|
Chris@16
|
57 }
|
Chris@16
|
58
|
Chris@16
|
59 #if defined(BOOST_GEOMETRY_DEBUG_IDENTIFIER)
|
Chris@16
|
60 friend std::ostream& operator<<(std::ostream &os, ring_identifier const& ring_id)
|
Chris@16
|
61 {
|
Chris@16
|
62 os << "(s:" << ring_id.source_index;
|
Chris@16
|
63 if (ring_id.ring_index >= 0) os << ", r:" << ring_id.ring_index;
|
Chris@16
|
64 if (ring_id.multi_index >= 0) os << ", m:" << ring_id.multi_index;
|
Chris@16
|
65 os << ")";
|
Chris@16
|
66 return os;
|
Chris@16
|
67 }
|
Chris@16
|
68 #endif
|
Chris@16
|
69
|
Chris@16
|
70
|
Chris@101
|
71 signed_index_type source_index;
|
Chris@101
|
72 signed_index_type multi_index;
|
Chris@101
|
73 signed_index_type ring_index;
|
Chris@16
|
74 };
|
Chris@16
|
75
|
Chris@16
|
76
|
Chris@16
|
77 }} // namespace boost::geometry
|
Chris@16
|
78
|
Chris@16
|
79
|
Chris@16
|
80 #endif // BOOST_GEOMETRY_ALGORITHMS_DETAIL_RING_IDENTIFIER_HPP
|