Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2024-11-15 09:10:35

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_RING_IDENTIFIER_HPP
0010 #define BOOST_GEOMETRY_ALGORITHMS_DETAIL_RING_IDENTIFIER_HPP
0011 
0012 
0013 #if defined(BOOST_GEOMETRY_DEBUG_IDENTIFIER)
0014 #include <iostream>
0015 #endif
0016 
0017 
0018 #include <boost/geometry/algorithms/detail/signed_size_type.hpp>
0019 
0020 
0021 namespace boost { namespace geometry
0022 {
0023 
0024 
0025 // Ring Identifier. It is currently: source,multi,ring
0026 struct ring_identifier
0027 {
0028 
0029     inline ring_identifier()
0030         : source_index(-1)
0031         , multi_index(-1)
0032         , ring_index(-1)
0033     {}
0034 
0035     inline ring_identifier(signed_size_type src,
0036                            signed_size_type mul,
0037                            signed_size_type rin)
0038         : source_index(src)
0039         , multi_index(mul)
0040         , ring_index(rin)
0041     {}
0042 
0043     inline bool operator<(ring_identifier const& other) const
0044     {
0045         return source_index != other.source_index ? source_index < other.source_index
0046             : multi_index !=other.multi_index ? multi_index < other.multi_index
0047             : ring_index < other.ring_index
0048             ;
0049     }
0050 
0051     inline bool operator==(ring_identifier const& other) const
0052     {
0053         return source_index == other.source_index
0054             && ring_index == other.ring_index
0055             && multi_index == other.multi_index
0056             ;
0057     }
0058 
0059     inline bool operator!=(ring_identifier const& other) const
0060     {
0061         return ! operator==(other);
0062     }
0063 
0064 #if defined(BOOST_GEOMETRY_DEBUG_IDENTIFIER)
0065     friend std::ostream& operator<<(std::ostream &os, ring_identifier const& ring_id)
0066     {
0067         os << "(s:" << ring_id.source_index;
0068         if (ring_id.ring_index >= 0) os << ", r:" << ring_id.ring_index;
0069         if (ring_id.multi_index >= 0) os << ", m:" << ring_id.multi_index;
0070         os << ")";
0071         return os;
0072     }
0073 #endif
0074 
0075 
0076     signed_size_type source_index;
0077     signed_size_type multi_index;
0078     signed_size_type ring_index;
0079 };
0080 
0081 
0082 }} // namespace boost::geometry
0083 
0084 
0085 #endif // BOOST_GEOMETRY_ALGORITHMS_DETAIL_RING_IDENTIFIER_HPP