22 #ifndef GUDHI_SKELETON_BLOCKERS_VERTICES_ITERATORS_H_
23 #define GUDHI_SKELETON_BLOCKERS_VERTICES_ITERATORS_H_
25 #include "boost/iterator/iterator_facade.hpp"
37 template<
typename SkeletonBlockerComplex>
39 < Complex_vertex_iterator <SkeletonBlockerComplex>
40 , typename SkeletonBlockerComplex::Vertex_handle const
41 , boost::forward_traversal_tag
42 , typename SkeletonBlockerComplex::Vertex_handle const
45 friend class boost::iterator_core_access;
47 typedef typename SkeletonBlockerComplex::boost_vertex_iterator boost_vertex_iterator;
48 typedef typename SkeletonBlockerComplex::Vertex_handle Vertex_handle;
50 const SkeletonBlockerComplex* complex;
51 std::pair<boost_vertex_iterator,boost_vertex_iterator> vertexIterator;
60 vertexIterator(vertices(complex_->skeleton)){
61 if(!finished() && !is_active()) {
70 complex(complex_),vertexIterator(vertices(complex_->skeleton)){
71 vertexIterator.first = vertexIterator.second ;
75 void increment () {goto_next_valid();}
76 Vertex_handle dereference()
const {
77 return(Vertex_handle(*(vertexIterator.first)));
80 bool equal(
const Complex_vertex_iterator& other)
const{
81 return vertexIterator == other.vertexIterator && complex == other.complex;
84 bool operator<(
const Complex_vertex_iterator& other)
const{
85 return dereference()<other.dereference();
89 bool finished()
const{
90 return vertexIterator.first == vertexIterator.second;
93 void goto_next_valid(){
94 ++vertexIterator.first;
95 if(!finished() && !is_active()){
100 bool is_active()
const{
101 return ((*complex)[Vertex_handle(*vertexIterator.first)]).is_active();
109 template<
typename SkeletonBlockerComplex>
110 class Complex_neighbors_vertices_iterator
111 :
public boost::iterator_facade < Complex_neighbors_vertices_iterator<SkeletonBlockerComplex>
112 , typename SkeletonBlockerComplex::Vertex_handle const
113 , boost::forward_traversal_tag
114 , typename SkeletonBlockerComplex::Vertex_handle const
117 friend class boost::iterator_core_access;
119 typedef SkeletonBlockerComplex Complex;
120 typedef typename Complex::boost_adjacency_iterator boost_adjacency_iterator;
121 typedef typename Complex::Vertex_handle Vertex_handle;
122 typedef typename Complex::Edge_handle Edge_handle;
126 const Complex* complex;
129 boost_adjacency_iterator current_;
130 boost_adjacency_iterator end_;
136 Complex_neighbors_vertices_iterator():complex(NULL){
139 Complex_neighbors_vertices_iterator(
const Complex* complex_,Vertex_handle v_):
142 tie(current_,end_) = adjacent_vertices(v.vertex, complex->skeleton);
148 Complex_neighbors_vertices_iterator(
const Complex* complex_,Vertex_handle v_,
int end):
151 tie(current_,end_) = adjacent_vertices(v.vertex, complex->skeleton);
161 Vertex_handle dereference()
const {
162 return(Vertex_handle(*current_));
165 bool equal(
const Complex_neighbors_vertices_iterator& other)
const{
166 return (complex== other.complex) && (v == other.v) && (current_ == other.current_) && (end_ == other.end_);
Iterator on the vertices of a simplicial complex.
Definition: Skeleton_blockers_vertices_iterators.h:38
Complex_vertex_iterator(const SkeletonBlockerComplex *complex_, int end)
Definition: Skeleton_blockers_vertices_iterators.h:69