22 #ifndef SKELETON_BLOCKER_ITERATORS_SKELETON_BLOCKERS_EDGES_ITERATORS_H_
23 #define SKELETON_BLOCKER_ITERATORS_SKELETON_BLOCKERS_EDGES_ITERATORS_H_
25 #include <boost/iterator/iterator_facade.hpp>
26 #include <boost/graph/adjacency_list.hpp>
34 template<
typename SkeletonBlockerComplex>
35 class Edge_around_vertex_iterator :
public boost::iterator_facade <Edge_around_vertex_iterator<SkeletonBlockerComplex>
36 , typename SkeletonBlockerComplex::Edge_handle const, boost::forward_traversal_tag
37 , typename SkeletonBlockerComplex::Edge_handle const> {
38 friend class boost::iterator_core_access;
40 typedef SkeletonBlockerComplex
Complex;
41 typedef typename Complex::boost_adjacency_iterator boost_adjacency_iterator;
43 typedef typename Complex::Edge_handle Edge_handle;
49 boost_adjacency_iterator current_;
50 boost_adjacency_iterator end_;
53 Edge_around_vertex_iterator() : complex(NULL) { }
55 Edge_around_vertex_iterator(
const Complex* complex_, Vertex_handle v_) :
58 tie(current_, end_) = adjacent_vertices(v.vertex, complex->skeleton);
64 Edge_around_vertex_iterator(
const Complex* complex_, Vertex_handle v_,
int end) :
67 tie(current_, end_) = adjacent_vertices(v.vertex, complex->skeleton);
71 bool equal(
const Edge_around_vertex_iterator& other)
const {
72 return (complex == other.complex) && (v == other.v) && (current_ == other.current_) && (end_ == other.end_);
80 Edge_handle dereference()
const {
81 return *(*complex)[std::make_pair(v, static_cast<Vertex_handle> (*current_))];
95 template<
typename SkeletonBlockerComplex>
96 class Edge_iterator :
public boost::iterator_facade <Edge_iterator<SkeletonBlockerComplex>
97 , typename SkeletonBlockerComplex::Edge_handle const
98 , boost::forward_traversal_tag
99 , typename SkeletonBlockerComplex::Edge_handle const> {
100 friend class boost::iterator_core_access;
103 typedef SkeletonBlockerComplex Complex;
104 typedef typename Complex::boost_edge_iterator boost_edge_iterator;
105 typedef typename Complex::Edge_handle Edge_handle;
107 const Complex* complex;
108 std::pair<boost_edge_iterator, boost_edge_iterator> edge_iterator;
114 edge_iterator(boost::edges(complex_->skeleton)) { }
121 edge_iterator(boost::edges(complex_->skeleton)) {
122 edge_iterator.first = edge_iterator.second;
126 return (complex == other.complex) && (edge_iterator == other.edge_iterator);
130 if (edge_iterator.first != edge_iterator.second) {
131 ++(edge_iterator.first);
135 Edge_handle dereference()
const {
136 return (*(edge_iterator.first));
144 #endif // SKELETON_BLOCKER_ITERATORS_SKELETON_BLOCKERS_EDGES_ITERATORS_H_
Edge_iterator(const SkeletonBlockerComplex *complex_, int end)
Definition: Skeleton_blockers_edges_iterators.h:119
Iterator on the edges of a simplicial complex.
Definition: Skeleton_blockers_edges_iterators.h:96
Definition: SkeletonBlockerDS.h:60