44 #ifndef OPENMESH_ITERATORS_HH 45 #define OPENMESH_ITERATORS_HH 57 #include <OpenMesh/Core/System/config.h> 58 #include <OpenMesh/Core/Mesh/Status.hh> 83 template <
class Mesh,
class ValueHandle,
class MemberOwner,
bool (MemberOwner::*PrimitiveStatusMember)() const,
size_t (MemberOwner::*PrimitiveCountMember)() const>
88 typedef ValueHandle value_handle;
89 typedef value_handle value_type;
90 typedef std::bidirectional_iterator_tag iterator_category;
91 typedef std::ptrdiff_t difference_type;
92 typedef const value_type& reference;
93 typedef const value_type* pointer;
99 : mesh_(0), skip_bits_(0)
104 : mesh_(&_mesh), hnd_(_hnd), skip_bits_(0)
124 OM_DEPRECATED(
"This function clutters your code. Use dereferencing operators -> and * instead.")
135 OM_DEPRECATED(
"Implicit casts of iterators are unsafe. Use dereferencing operators -> and * instead.")
136 operator value_handle()
const {
142 return ((mesh_ == _rhs.mesh_) && (hnd_ == _rhs.hnd_));
165 #if ((defined(_MSC_VER) && (_MSC_VER >= 1800)) || __cplusplus > 199711L || defined(__GXX_EXPERIMENTAL_CXX0X__)) && !defined(OPENMESH_VECTOR_LEGACY) 166 template<
class T = value_handle>
167 auto operator+=(
int amount) ->
168 typename std::enable_if<
169 sizeof(decltype(std::declval<T>().__increment(amount))) >= 0,
171 static_assert(std::is_same<T, value_handle>::value,
172 "Template parameter must not deviate from default.");
174 throw std::logic_error(
"Skipping iterators do not support " 176 hnd_.__increment(amount);
180 template<
class T = value_handle>
181 auto operator+(
int rhs) ->
182 typename std::enable_if<
183 sizeof(decltype(std::declval<T>().__increment(rhs),
void (),
int {})) >= 0,
185 static_assert(std::is_same<T, value_handle>::value,
186 "Template parameter must not deviate from default.");
188 throw std::logic_error(
"Skipping iterators do not support " 191 result.hnd_.__increment(rhs);
213 if (mesh_ && (mesh_->*PrimitiveStatusMember)()) {
217 skip_bits_ = status.
bits();
231 assert(mesh_ && skip_bits_);
232 while ((hnd_.idx() < (signed) (mesh_->*PrimitiveCountMember)())
233 && (mesh_->status(hnd_).bits() & skip_bits_))
238 assert(mesh_ && skip_bits_);
239 while ((hnd_.idx() >= 0) && (mesh_->status(hnd_).bits() & skip_bits_))
246 unsigned int skip_bits_;
reference operator*() const
Standard dereferencing operator.
Definition: IteratorsT.hh:110
void set_hidden(bool _b)
set hidden
Definition: Status.hh:123
void set_deleted(bool _b)
set deleted
Definition: Status.hh:105
Add status information to a base class.
Definition: Status.hh:94
unsigned int bits() const
return whole status
Definition: Status.hh:151
GenericIteratorT & operator++()
Standard pre-increment operator.
Definition: IteratorsT.hh:151
void enable_skipping()
Turn on skipping: automatically skip deleted/hidden elements.
Definition: IteratorsT.hh:212
GenericIteratorT(mesh_ref _mesh, value_handle _hnd, bool _skip=false)
Construct with mesh and a target handle.
Definition: IteratorsT.hh:103
Definition: IteratorsT.hh:76
value_handle handle() const
Get the handle of the item the iterator refers to.
Definition: IteratorsT.hh:125
bool operator==(const GenericIteratorT &_rhs) const
Are two iterators equal? Only valid if they refer to the same mesh!
Definition: IteratorsT.hh:141
Definition: IteratorsT.hh:84
GenericIteratorT operator--(int)
Standard post-decrement operator.
Definition: IteratorsT.hh:205
Definition: IteratorsT.hh:73
Contains all the mesh ingredients like the polygonal mesh, the triangle mesh, different mesh kernels ...
Definition: MeshItems.hh:59
bool operator!=(const GenericIteratorT &_rhs) const
Not equal?
Definition: IteratorsT.hh:146
Definition: IteratorsT.hh:78
Definition: IteratorsT.hh:75
GenericIteratorT()
Default constructor.
Definition: IteratorsT.hh:98
void disable_skipping()
Turn on skipping: automatically skip deleted/hidden elements.
Definition: IteratorsT.hh:224
GenericIteratorT & operator--()
Standard pre-decrement operator.
Definition: IteratorsT.hh:197
Definition: IteratorsT.hh:80
pointer operator->() const
Standard pointer operator.
Definition: IteratorsT.hh:115
GenericIteratorT operator++(int)
Standard post-increment operator.
Definition: IteratorsT.hh:159
Definition: IteratorsT.hh:77
Definition: IteratorsT.hh:74
Polygonal mesh based on the ArrayKernel.
Definition: PolyMesh_ArrayKernelT.hh:94
Definition: IteratorsT.hh:79