11 #ifndef SKELETON_BLOCKER_ITERATORS_SKELETON_BLOCKERS_EDGES_ITERATORS_H_ 12 #define SKELETON_BLOCKER_ITERATORS_SKELETON_BLOCKERS_EDGES_ITERATORS_H_ 14 #include <boost/iterator/iterator_facade.hpp> 15 #include <boost/graph/adjacency_list.hpp> 21 namespace skeleton_blocker {
23 template<
typename SkeletonBlockerComplex>
24 class Edge_around_vertex_iterator :
public boost::iterator_facade <Edge_around_vertex_iterator<SkeletonBlockerComplex>
25 , typename SkeletonBlockerComplex::Edge_handle const, boost::forward_traversal_tag
26 , typename SkeletonBlockerComplex::Edge_handle const> {
27 friend class boost::iterator_core_access;
29 typedef SkeletonBlockerComplex Complex;
30 typedef typename Complex::boost_adjacency_iterator boost_adjacency_iterator;
31 typedef typename Complex::Vertex_handle Vertex_handle;
32 typedef typename Complex::Edge_handle Edge_handle;
35 const Complex* complex;
38 boost_adjacency_iterator current_;
39 boost_adjacency_iterator end_;
42 Edge_around_vertex_iterator() : complex(NULL) { }
44 Edge_around_vertex_iterator(
const Complex* complex_, Vertex_handle v_) :
47 tie(current_, end_) = adjacent_vertices(v.vertex, complex->skeleton);
53 Edge_around_vertex_iterator(
const Complex* complex_, Vertex_handle v_,
int end) :
56 tie(current_, end_) = adjacent_vertices(v.vertex, complex->skeleton);
60 bool equal(
const Edge_around_vertex_iterator& other)
const {
61 return (complex == other.complex) && (v == other.v) && (current_ == other.current_) && (end_ == other.end_);
69 Edge_handle dereference()
const {
70 return *(*complex)[std::make_pair(v, static_cast<Vertex_handle> (*current_))];
84 template<
typename SkeletonBlockerComplex>
85 class Edge_iterator :
public boost::iterator_facade <Edge_iterator<SkeletonBlockerComplex>
86 , typename SkeletonBlockerComplex::Edge_handle const
87 , boost::forward_traversal_tag
88 , typename SkeletonBlockerComplex::Edge_handle const> {
89 friend class boost::iterator_core_access;
92 typedef SkeletonBlockerComplex Complex;
93 typedef typename Complex::boost_edge_iterator boost_edge_iterator;
94 typedef typename Complex::Edge_handle Edge_handle;
96 const Complex* complex;
97 std::pair<boost_edge_iterator, boost_edge_iterator> edge_iterator;
103 edge_iterator(boost::edges(complex_->skeleton)) { }
110 edge_iterator(boost::edges(complex_->skeleton)) {
111 edge_iterator.first = edge_iterator.second;
115 return (complex == other.complex) && (edge_iterator == other.edge_iterator);
119 if (edge_iterator.first != edge_iterator.second) {
120 ++(edge_iterator.first);
124 Edge_handle dereference()
const {
125 return (*(edge_iterator.first));
131 namespace skbl = skeleton_blocker;
135 #endif // SKELETON_BLOCKER_ITERATORS_SKELETON_BLOCKERS_EDGES_ITERATORS_H_ Definition: SimplicialComplexForAlpha.h:14
Iterator on the edges of a simplicial complex.
Definition: Skeleton_blockers_edges_iterators.h:85
Edge_iterator(const SkeletonBlockerComplex *complex_, int end)
Definition: Skeleton_blockers_edges_iterators.h:108