49 #ifndef OPENMESH_ITERATORS_HH 50 #define OPENMESH_ITERATORS_HH 62 #include <OpenMesh/Core/System/config.h> 63 #include <OpenMesh/Core/Mesh/Status.hh> 88 template <
class Mesh,
class ValueHandle,
class MemberOwner,
bool (MemberOwner::*PrimitiveStatusMember)() const,
size_t (MemberOwner::*PrimitiveCountMember)() const>
93 typedef ValueHandle value_handle;
94 typedef value_handle value_type;
95 typedef std::bidirectional_iterator_tag iterator_category;
96 typedef std::ptrdiff_t difference_type;
97 typedef const value_type& reference;
98 typedef const value_type* pointer;
99 typedef const Mesh* mesh_ptr;
100 typedef const Mesh& mesh_ref;
104 : mesh_(0), skip_bits_(0)
109 : mesh_(&_mesh), hnd_(_hnd), skip_bits_(0)
114 if((mesh_->*PrimitiveCountMember)() == 0) hnd_ = value_handle(-1);
132 DEPRECATED(
"This function clutters your code. Use dereferencing operators -> and * instead.")
143 DEPRECATED(
"Implicit casts of iterators are unsafe. Use dereferencing operators -> and * instead.")
144 operator value_handle()
const {
150 return ((mesh_ == _rhs.mesh_) && (hnd_ == _rhs.hnd_));
173 #if ((defined(_MSC_VER) && (_MSC_VER >= 1900)) || __cplusplus > 199711L || defined(__GXX_EXPERIMENTAL_CXX0X__)) && !defined(OPENMESH_VECTOR_LEGACY) 174 template<
class T = value_handle>
175 auto operator+=(
int amount) ->
176 typename std::enable_if<
177 sizeof(decltype(std::declval<T>().__increment(amount))) >= 0,
179 static_assert(std::is_same<T, value_handle>::value,
180 "Template parameter must not deviate from default.");
182 throw std::logic_error(
"Skipping iterators do not support " 184 hnd_.__increment(amount);
188 template<
class T = value_handle>
189 auto operator+(
int rhs) ->
190 typename std::enable_if<
191 sizeof(decltype(std::declval<T>().__increment(rhs),
void (),
int {})) >= 0,
193 static_assert(std::is_same<T, value_handle>::value,
194 "Template parameter must not deviate from default.");
196 throw std::logic_error(
"Skipping iterators do not support " 199 result.hnd_.__increment(rhs);
221 if (mesh_ && (mesh_->*PrimitiveStatusMember)()) {
225 skip_bits_ = status.
bits();
239 assert(mesh_ && skip_bits_);
240 while ((hnd_.idx() < (signed) (mesh_->*PrimitiveCountMember)())
241 && (mesh_->status(hnd_).bits() & skip_bits_))
246 assert(mesh_ && skip_bits_);
247 while ((hnd_.idx() >= 0) && (mesh_->status(hnd_).bits() & skip_bits_))
254 unsigned int skip_bits_;
GenericIteratorT & operator++()
Standard pre-increment operator.
Definition: IteratorsT.hh:159
Definition: IteratorsT.hh:78
Definition: IteratorsT.hh:84
GenericIteratorT operator--(int)
Standard post-decrement operator.
Definition: IteratorsT.hh:213
unsigned int bits() const
return whole status
Definition: Status.hh:156
Definition: IteratorsT.hh:89
Definition: IteratorsT.hh:83
GenericIteratorT()
Default constructor.
Definition: IteratorsT.hh:103
value_handle handle() const
Get the handle of the item the iterator refers to.
Definition: IteratorsT.hh:133
GenericIteratorT(mesh_ref _mesh, value_handle _hnd, bool _skip=false)
Construct with mesh and a target handle.
Definition: IteratorsT.hh:108
GenericIteratorT operator++(int)
Standard post-increment operator.
Definition: IteratorsT.hh:167
Add status information to a base class.
Definition: Status.hh:99
Definition: IteratorsT.hh:82
void set_deleted(bool _b)
set deleted
Definition: Status.hh:110
void enable_skipping()
Turn on skipping: automatically skip deleted/hidden elements.
Definition: IteratorsT.hh:220
Definition: IteratorsT.hh:79
GenericIteratorT & operator--()
Standard pre-decrement operator.
Definition: IteratorsT.hh:205
bool operator==(const GenericIteratorT &_rhs) const
Are two iterators equal? Only valid if they refer to the same mesh!
Definition: IteratorsT.hh:149
Definition: IteratorsT.hh:85
reference operator*() const
Standard dereferencing operator.
Definition: IteratorsT.hh:118
Definition: IteratorsT.hh:81
bool operator!=(const GenericIteratorT &_rhs) const
Not equal?
Definition: IteratorsT.hh:154
void set_hidden(bool _b)
set hidden
Definition: Status.hh:128
pointer operator->() const
Standard pointer operator.
Definition: IteratorsT.hh:123
Definition: IteratorsT.hh:80
void disable_skipping()
Turn on skipping: automatically skip deleted/hidden elements.
Definition: IteratorsT.hh:232
Contains all the mesh ingredients like the polygonal mesh, the triangle mesh, different mesh kernels ...
Definition: MeshItems.hh:64