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)
129 DEPRECATED(
"This function clutters your code. Use dereferencing operators -> and * instead.")
140 DEPRECATED(
"Implicit casts of iterators are unsafe. Use dereferencing operators -> and * instead.")
141 operator value_handle()
const {
147 return ((mesh_ == _rhs.mesh_) && (hnd_ == _rhs.hnd_));
170 #if ((defined(_MSC_VER) && (_MSC_VER >= 1800)) || __cplusplus > 199711L || defined(__GXX_EXPERIMENTAL_CXX0X__)) && !defined(OPENMESH_VECTOR_LEGACY) 171 template<
class T = value_handle>
172 auto operator+=(
int amount) ->
173 typename std::enable_if<
174 sizeof(decltype(std::declval<T>().__increment(amount))) >= 0,
176 static_assert(std::is_same<T, value_handle>::value,
177 "Template parameter must not deviate from default.");
179 throw std::logic_error(
"Skipping iterators do not support " 181 hnd_.__increment(amount);
185 template<
class T = value_handle>
186 auto operator+(
int rhs) ->
187 typename std::enable_if<
188 sizeof(decltype(std::declval<T>().__increment(rhs),
void (),
int {})) >= 0,
190 static_assert(std::is_same<T, value_handle>::value,
191 "Template parameter must not deviate from default.");
193 throw std::logic_error(
"Skipping iterators do not support " 196 result.hnd_.__increment(rhs);
218 if (mesh_ && (mesh_->*PrimitiveStatusMember)()) {
222 skip_bits_ = status.
bits();
236 assert(mesh_ && skip_bits_);
237 while ((hnd_.idx() < (signed) (mesh_->*PrimitiveCountMember)())
238 && (mesh_->status(hnd_).bits() & skip_bits_))
243 assert(mesh_ && skip_bits_);
244 while ((hnd_.idx() >= 0) && (mesh_->status(hnd_).bits() & skip_bits_))
251 unsigned int skip_bits_;
Add status information to a base class.
Definition: Status.hh:99
GenericIteratorT & operator++()
Standard pre-increment operator.
Definition: IteratorsT.hh:156
Definition: IteratorsT.hh:83
Definition: IteratorsT.hh:80
reference operator*() const
Standard dereferencing operator.
Definition: IteratorsT.hh:115
void disable_skipping()
Turn on skipping: automatically skip deleted/hidden elements.
Definition: IteratorsT.hh:229
Definition: IteratorsT.hh:82
Definition: IteratorsT.hh:84
GenericIteratorT(mesh_ref _mesh, value_handle _hnd, bool _skip=false)
Construct with mesh and a target handle.
Definition: IteratorsT.hh:108
Contains all the mesh ingredients like the polygonal mesh, the triangle mesh, different mesh kernels ...
Definition: MeshItems.hh:64
GenericIteratorT operator++(int)
Standard post-increment operator.
Definition: IteratorsT.hh:164
value_handle handle() const
Get the handle of the item the iterator refers to.
Definition: IteratorsT.hh:130
bool operator==(const GenericIteratorT &_rhs) const
Are two iterators equal? Only valid if they refer to the same mesh!
Definition: IteratorsT.hh:146
void set_hidden(bool _b)
set hidden
Definition: Status.hh:128
void set_deleted(bool _b)
set deleted
Definition: Status.hh:110
GenericIteratorT operator--(int)
Standard post-decrement operator.
Definition: IteratorsT.hh:210
Definition: IteratorsT.hh:89
GenericIteratorT()
Default constructor.
Definition: IteratorsT.hh:103
Definition: IteratorsT.hh:79
Definition: IteratorsT.hh:85
pointer operator->() const
Standard pointer operator.
Definition: IteratorsT.hh:120
void enable_skipping()
Turn on skipping: automatically skip deleted/hidden elements.
Definition: IteratorsT.hh:217
bool operator!=(const GenericIteratorT &_rhs) const
Not equal?
Definition: IteratorsT.hh:151
GenericIteratorT & operator--()
Standard pre-decrement operator.
Definition: IteratorsT.hh:202
unsigned int bits() const
return whole status
Definition: Status.hh:156
Definition: IteratorsT.hh:81
Definition: IteratorsT.hh:78