]> git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/geometry/include/boost/geometry/algorithms/detail/ring_identifier.hpp
add subtree-ish sources for 12.0.3
[ceph.git] / ceph / src / boost / libs / geometry / include / boost / geometry / algorithms / detail / ring_identifier.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_RING_IDENTIFIER_HPP
10 #define BOOST_GEOMETRY_ALGORITHMS_DETAIL_RING_IDENTIFIER_HPP
11
12
13 #if defined(BOOST_GEOMETRY_DEBUG_IDENTIFIER)
14 #include <iostream>
15 #endif
16
17
18 #include <boost/geometry/algorithms/detail/signed_size_type.hpp>
19
20
21 namespace boost { namespace geometry
22 {
23
24
25 // Ring Identifier. It is currently: source,multi,ring
26 struct ring_identifier
27 {
28
29 inline ring_identifier()
30 : source_index(-1)
31 , multi_index(-1)
32 , ring_index(-1)
33 {}
34
35 inline ring_identifier(signed_size_type src,
36 signed_size_type mul,
37 signed_size_type rin)
38 : source_index(src)
39 , multi_index(mul)
40 , ring_index(rin)
41 {}
42
43 inline bool operator<(ring_identifier const& other) const
44 {
45 return source_index != other.source_index ? source_index < other.source_index
46 : multi_index !=other.multi_index ? multi_index < other.multi_index
47 : ring_index < other.ring_index
48 ;
49 }
50
51 inline bool operator==(ring_identifier const& other) const
52 {
53 return source_index == other.source_index
54 && ring_index == other.ring_index
55 && multi_index == other.multi_index
56 ;
57 }
58
59 inline bool operator!=(ring_identifier const& other) const
60 {
61 return ! operator==(other);
62 }
63
64 #if defined(BOOST_GEOMETRY_DEBUG_IDENTIFIER)
65 friend std::ostream& operator<<(std::ostream &os, ring_identifier const& ring_id)
66 {
67 os << "(s:" << ring_id.source_index;
68 if (ring_id.ring_index >= 0) os << ", r:" << ring_id.ring_index;
69 if (ring_id.multi_index >= 0) os << ", m:" << ring_id.multi_index;
70 os << ")";
71 return os;
72 }
73 #endif
74
75
76 signed_size_type source_index;
77 signed_size_type multi_index;
78 signed_size_type ring_index;
79 };
80
81
82 }} // namespace boost::geometry
83
84
85 #endif // BOOST_GEOMETRY_ALGORITHMS_DETAIL_RING_IDENTIFIER_HPP