/Src/Dependencies/Boost/boost/geometry/algorithms/detail/ring_identifier.hpp

http://hadesmem.googlecode.com/ · C++ Header · 70 lines · 46 code · 18 blank · 6 comment · 8 complexity · a3fe34f718c88484cc027f863876e51f MD5 · raw file

  1. // Boost.Geometry (aka GGL, Generic Geometry Library)
  2. // Copyright (c) 2007-2011 Barend Gehrels, Amsterdam, the Netherlands.
  3. // Use, modification and distribution is subject to the Boost Software License,
  4. // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
  5. // http://www.boost.org/LICENSE_1_0.txt)
  6. #ifndef BOOST_GEOMETRY_ALGORITHMS_DETAIL_RING_IDENTIFIER_HPP
  7. #define BOOST_GEOMETRY_ALGORITHMS_DETAIL_RING_IDENTIFIER_HPP
  8. namespace boost { namespace geometry
  9. {
  10. // Ring Identifier. It is currently: source,multi,ring
  11. struct ring_identifier
  12. {
  13. inline ring_identifier()
  14. : source_index(-1)
  15. , multi_index(-1)
  16. , ring_index(-1)
  17. {}
  18. inline ring_identifier(int src, int mul, int rin)
  19. : source_index(src)
  20. , multi_index(mul)
  21. , ring_index(rin)
  22. {}
  23. inline bool operator<(ring_identifier const& other) const
  24. {
  25. return source_index != other.source_index ? source_index < other.source_index
  26. : multi_index !=other.multi_index ? multi_index < other.multi_index
  27. : ring_index < other.ring_index
  28. ;
  29. }
  30. inline bool operator==(ring_identifier const& other) const
  31. {
  32. return source_index == other.source_index
  33. && ring_index == other.ring_index
  34. && multi_index == other.multi_index
  35. ;
  36. }
  37. #if defined(BOOST_GEOMETRY_DEBUG_IDENTIFIER)
  38. friend std::ostream& operator<<(std::ostream &os, ring_identifier const& ring_id)
  39. {
  40. os << "(s:" << ring_id.source_index;
  41. if (ring_id.ring_index >= 0) os << ", r:" << ring_id.ring_index;
  42. if (ring_id.multi_index >= 0) os << ", m:" << ring_id.multi_index;
  43. os << ")";
  44. return os;
  45. }
  46. #endif
  47. int source_index;
  48. int multi_index;
  49. int ring_index;
  50. };
  51. }} // namespace boost::geometry
  52. #endif // BOOST_GEOMETRY_ALGORITHMS_DETAIL_RING_IDENTIFIER_HPP