42 #ifndef OPENMESH_ITERATORS_HH
43 #define OPENMESH_ITERATORS_HH
55 #include <OpenMesh/Core/System/config.h>
56 #include <OpenMesh/Core/Mesh/Status.hh>
81 template <
class Mesh,
class ValueHandle,
class MemberOwner,
bool (MemberOwner::*PrimitiveStatusMember)() const,
size_t (MemberOwner::*PrimitiveCountMember)() const>
86 typedef ValueHandle value_handle;
87 typedef value_handle value_type;
88 typedef std::bidirectional_iterator_tag iterator_category;
89 typedef std::ptrdiff_t difference_type;
90 typedef const value_type& reference;
91 typedef const value_type* pointer;
92 typedef const Mesh* mesh_ptr;
93 typedef const Mesh& mesh_ref;
97 : mesh_(0), skip_bits_(0)
102 : mesh_(&_mesh), hnd_(_hnd), skip_bits_(0)
107 if((mesh_->*PrimitiveCountMember)() == 0) hnd_ = value_handle(-1);
125 DEPRECATED(
"This function clutters your code. Use dereferencing operators -> and * instead.")
136 DEPRECATED(
"Implicit casts of iterators are unsafe. Use dereferencing operators -> and * instead.")
137 operator value_handle()
const {
143 return ((mesh_ == _rhs.mesh_) && (hnd_ == _rhs.hnd_));
183 if (mesh_ && (mesh_->*PrimitiveStatusMember)()) {
187 skip_bits_ = status.
bits();
201 assert(mesh_ && skip_bits_);
202 while ((hnd_.idx() < (signed) (mesh_->*PrimitiveCountMember)())
203 && (mesh_->status(hnd_).bits() & skip_bits_))
208 assert(mesh_ && skip_bits_);
209 while ((hnd_.idx() >= 0) && (mesh_->status(hnd_).bits() & skip_bits_))
216 unsigned int skip_bits_;
bool operator==(const GenericIteratorT &_rhs) const
Are two iterators equal? Only valid if they refer to the same mesh!
Definition: IteratorsT.hh:142
Definition: IteratorsT.hh:72
Definition: IteratorsT.hh:74
Definition: IteratorsT.hh:76
GenericIteratorT & operator++()
Standard pre-increment operator.
Definition: IteratorsT.hh:152
Definition: IteratorsT.hh:75
pointer operator->() const
Standard pointer operator.
Definition: IteratorsT.hh:116
Contains all the mesh ingredients like the polygonal mesh, the triangle mesh, different mesh kernels ...
Definition: MeshItems.hh:56
GenericIteratorT()
Default constructor.
Definition: IteratorsT.hh:96
void set_hidden(bool _b)
set hidden
Definition: Status.hh:121
Definition: IteratorsT.hh:71
Definition: IteratorsT.hh:78
GenericIteratorT operator--(int)
Standard post-decrement operator.
Definition: IteratorsT.hh:175
void set_deleted(bool _b)
set deleted
Definition: Status.hh:103
Definition: IteratorsT.hh:82
void enable_skipping()
Turn on skipping: automatically skip deleted/hidden elements.
Definition: IteratorsT.hh:182
Definition: IteratorsT.hh:73
reference operator*() const
Standard dereferencing operator.
Definition: IteratorsT.hh:111
bool operator!=(const GenericIteratorT &_rhs) const
Not equal?
Definition: IteratorsT.hh:147
value_handle handle() const
Get the handle of the item the iterator refers to.
Definition: IteratorsT.hh:126
Add status information to a base class.
Definition: Status.hh:92
void disable_skipping()
Turn on skipping: automatically skip deleted/hidden elements.
Definition: IteratorsT.hh:194
unsigned int bits() const
return whole status
Definition: Status.hh:149
GenericIteratorT(mesh_ref _mesh, value_handle _hnd, bool _skip=false)
Construct with mesh and a target handle.
Definition: IteratorsT.hh:101
GenericIteratorT operator++(int)
Standard post-increment operator.
Definition: IteratorsT.hh:160
Definition: IteratorsT.hh:77
GenericIteratorT & operator--()
Standard pre-decrement operator.
Definition: IteratorsT.hh:167