23 #ifndef SKELETON_BLOCKER_ITERATORS_SKELETON_BLOCKERS_EDGES_ITERATORS_H_ 24 #define SKELETON_BLOCKER_ITERATORS_SKELETON_BLOCKERS_EDGES_ITERATORS_H_ 26 #include <boost/iterator/iterator_facade.hpp> 27 #include <boost/graph/adjacency_list.hpp> 33 namespace skeleton_blocker {
35 template<
typename SkeletonBlockerComplex>
36 class Edge_around_vertex_iterator :
public boost::iterator_facade <Edge_around_vertex_iterator<SkeletonBlockerComplex>
37 , typename SkeletonBlockerComplex::Edge_handle const, boost::forward_traversal_tag
38 , typename SkeletonBlockerComplex::Edge_handle const> {
39 friend class boost::iterator_core_access;
41 typedef SkeletonBlockerComplex Complex;
42 typedef typename Complex::boost_adjacency_iterator boost_adjacency_iterator;
43 typedef typename Complex::Vertex_handle Vertex_handle;
44 typedef typename Complex::Edge_handle Edge_handle;
47 const Complex* complex;
50 boost_adjacency_iterator current_;
51 boost_adjacency_iterator end_;
54 Edge_around_vertex_iterator() : complex(NULL) { }
56 Edge_around_vertex_iterator(
const Complex* complex_, Vertex_handle v_) :
59 tie(current_, end_) = adjacent_vertices(v.vertex, complex->skeleton);
65 Edge_around_vertex_iterator(
const Complex* complex_, Vertex_handle v_,
int end) :
68 tie(current_, end_) = adjacent_vertices(v.vertex, complex->skeleton);
72 bool equal(
const Edge_around_vertex_iterator& other)
const {
73 return (complex == other.complex) && (v == other.v) && (current_ == other.current_) && (end_ == other.end_);
81 Edge_handle dereference()
const {
82 return *(*complex)[std::make_pair(v, static_cast<Vertex_handle> (*current_))];
96 template<
typename SkeletonBlockerComplex>
97 class Edge_iterator :
public boost::iterator_facade <Edge_iterator<SkeletonBlockerComplex>
98 , typename SkeletonBlockerComplex::Edge_handle const
99 , boost::forward_traversal_tag
100 , typename SkeletonBlockerComplex::Edge_handle const> {
101 friend class boost::iterator_core_access;
104 typedef SkeletonBlockerComplex Complex;
105 typedef typename Complex::boost_edge_iterator boost_edge_iterator;
106 typedef typename Complex::Edge_handle Edge_handle;
108 const Complex* complex;
109 std::pair<boost_edge_iterator, boost_edge_iterator> edge_iterator;
115 edge_iterator(boost::edges(complex_->skeleton)) { }
122 edge_iterator(boost::edges(complex_->skeleton)) {
123 edge_iterator.first = edge_iterator.second;
127 return (complex == other.complex) && (edge_iterator == other.edge_iterator);
131 if (edge_iterator.first != edge_iterator.second) {
132 ++(edge_iterator.first);
136 Edge_handle dereference()
const {
137 return (*(edge_iterator.first));
143 namespace skbl = skeleton_blocker;
147 #endif // SKELETON_BLOCKER_ITERATORS_SKELETON_BLOCKERS_EDGES_ITERATORS_H_ Definition: SimplicialComplexForAlpha.h:26
Iterator on the edges of a simplicial complex.
Definition: Skeleton_blockers_edges_iterators.h:97
Edge_iterator(const SkeletonBlockerComplex *complex_, int end)
Definition: Skeleton_blockers_edges_iterators.h:120