BWAPI
|
00001 // Copyright (c) 2005 Tel-Aviv University (Israel). 00002 // All rights reserved. 00003 // 00004 // This file is part of CGAL (www.cgal.org); you may redistribute it under 00005 // the terms of the Q Public License version 1.0. 00006 // See the file LICENSE.QPL distributed with CGAL. 00007 // 00008 // Licensees holding a valid commercial license may use this file in 00009 // accordance with the commercial license agreement provided with the software. 00010 // 00011 // This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE 00012 // WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. 00013 // 00014 // $URL: svn+ssh://scm.gforge.inria.fr/svn/cgal/branches/CGAL-3.5-branch/Boolean_set_operations_2/include/CGAL/Boolean_set_operations_2/Ccb_curve_iterator.h $ 00015 // $Id: Ccb_curve_iterator.h 48113 2009-02-17 16:21:43Z ophirset $ 00016 // 00017 // 00018 // Author(s) : Baruch Zukerman <baruchzu@post.tau.ac.il> 00019 00020 #ifndef CGAL_CCB_CURVE_ITERATOR_H 00021 #define CGAL_CCB_CURVE_ITERATOR_H 00022 00023 CGAL_BEGIN_NAMESPACE 00024 00028 template <class Arrangement_> 00029 class Ccb_curve_iterator 00030 { 00031 public: 00032 00033 typedef Arrangement_ Arrangement; 00034 typedef typename Arrangement::Geometry_traits_2 Traits; 00035 typedef Ccb_curve_iterator<Arrangement> Self; 00036 typedef typename Arrangement::Ccb_halfedge_const_circulator 00037 Ccb_halfedge_const_circulator; 00038 typedef typename Traits::X_monotone_curve_2 value_type; 00039 typedef std::forward_iterator_tag iterator_category; 00040 typedef const value_type& reference; 00041 typedef const value_type* pointer; 00042 typedef std::size_t difference_type; 00043 00044 private: 00045 00046 Ccb_halfedge_const_circulator _first; // The first halfedge. 00047 Ccb_halfedge_const_circulator _circ; // The current circulator. 00048 bool _done; // Indicates whether we completed 00049 // a full traversal of the CCB. 00050 00051 public: 00052 00054 Ccb_curve_iterator () : 00055 _done (true) 00056 {} 00057 00063 Ccb_curve_iterator (Ccb_halfedge_const_circulator circ, 00064 bool done = false) : 00065 _first (circ), 00066 _circ (circ), 00067 _done (done) 00068 {} 00069 00071 reference operator* () const 00072 { 00073 return (_circ->curve()); 00074 } 00075 00076 pointer operator-> () const 00077 { 00078 return (&(_circ->curve())); 00079 } 00080 00082 bool operator== (const Self& it) const 00083 { 00084 return (_done == it._done && _circ == it._circ); 00085 } 00086 00087 bool operator!= (const Self& it) const 00088 { 00089 return (_done != it._done || _circ != it._circ); 00090 } 00091 00093 Self& operator++ () 00094 { 00095 CGAL_assertion(!_done); 00096 00097 --_circ; 00098 00099 if (_circ == _first) 00100 _done = true; 00101 00102 00103 return (*this); 00104 } 00105 00106 Self operator++ (int ) 00107 { 00108 Self temp = *this; 00109 ++(*this); 00110 return (temp); 00111 } 00112 00113 }; 00114 00115 00116 CGAL_END_NAMESPACE 00117 00118 #endif