circulators_template.hh
//== CLASS DEFINITION =========================================================
template <class Mesh>
class CirculatorT
{
public:
//--- Typedefs ---
typedef typename Mesh::HalfedgeHandle HalfedgeHandle;
typedef TargetType value_type;
typedef TargetHandle value_handle;
#if IsConst
typedef const Mesh& mesh_ref;
typedef const Mesh* mesh_ptr;
typedef const TargetType& reference;
typedef const TargetType* pointer;
#else
typedef Mesh& mesh_ref;
typedef Mesh* mesh_ptr;
typedef TargetType& reference;
typedef TargetType* pointer;
#endif
CirculatorT() : mesh_(0), active_(false) {}
CirculatorT(mesh_ref _mesh, SourceHandle _start) :
mesh_(&_mesh),
start_(_mesh.halfedge_handle(_start)),
heh_(start_),
active_(false)
{ post_init; }
CirculatorT(mesh_ref _mesh, HalfedgeHandle _heh) :
mesh_(&_mesh),
start_(_heh),
heh_(_heh),
active_(false)
{ post_init; }
CirculatorT(const CirculatorT& _rhs) :
mesh_(_rhs.mesh_),
start_(_rhs.start_),
heh_(_rhs.heh_),
active_(_rhs.active_)
{ post_init; }
CirculatorT& operator=(const CirculatorT<Mesh>& _rhs)
{
mesh_ = _rhs.mesh_;
start_ = _rhs.start_;
heh_ = _rhs.heh_;
active_ = _rhs.active_;
return *this;
}
#if IsConst
CirculatorT(const NonConstCircT<Mesh>& _rhs) :
mesh_(_rhs.mesh_),
start_(_rhs.start_),
heh_(_rhs.heh_),
active_(_rhs.active_)
{ post_init; }
CirculatorT& operator=(const NonConstCircT<Mesh>& _rhs)
{
mesh_ = _rhs.mesh_;
start_ = _rhs.start_;
heh_ = _rhs.heh_;
active_ = _rhs.active_;
return *this;
}
#else
friend class ConstCircT<Mesh>;
#endif
bool operator==(const CirculatorT& _rhs) const {
return ((mesh_ == _rhs.mesh_) &&
(start_ == _rhs.start_) &&
(heh_ == _rhs.heh_) &&
(active_ == _rhs.active_));
}
bool operator!=(const CirculatorT& _rhs) const {
return !operator==(_rhs);
}
CirculatorT& operator++() {
assert(mesh_);
active_ = true;
increment;
return *this;
}
CirculatorT& operator--() {
assert(mesh_);
active_ = true;
decrement;
return *this;
}
HalfedgeHandle current_halfedge_handle() const {
return heh_;
}
TargetHandle handle() const {
assert(mesh_);
return get_handle;
}
operator TargetHandle() const {
assert(mesh_);
return get_handle;
}
reference operator*() const {
assert(mesh_);
return mesh_->deref(handle());
}
pointer operator->() const {
assert(mesh_);
return &mesh_->deref(handle());
}
operator bool() const {
return heh_.is_valid() && ((start_ != heh_) || (!active_));
}
private:
mesh_ptr mesh_;
HalfedgeHandle start_, heh_;
bool active_;
};
CirculatorT::handle
TargetHandle handle() const
Return the handle of the current target.
Definition: circulators_template.hh:144
CirculatorT::operator++
CirculatorT & operator++()
Pre-Increment (next cw target)
Definition: circulators_template.hh:117
CirculatorT::operator--
CirculatorT & operator--()
Pre-Decrement (next ccw target)
Definition: circulators_template.hh:126
CirculatorT::current_halfedge_handle
HalfedgeHandle current_halfedge_handle() const
Get the current halfedge.
Definition: circulators_template.hh:138
CirculatorT::operator*
reference operator*() const
Return a reference to the current target.
Definition: circulators_template.hh:158
CirculatorT::CirculatorT
CirculatorT()
Default constructor.
Definition: circulators_template.hh:36
CirculatorT::CirculatorT
CirculatorT(mesh_ref _mesh, SourceHandle _start)
Construct with mesh and a SourceHandle.
Definition: circulators_template.hh:40
CirculatorT::CirculatorT
CirculatorT(const CirculatorT &_rhs)
Copy constructor.
Definition: circulators_template.hh:58
CirculatorT::CirculatorT
CirculatorT(mesh_ref _mesh, HalfedgeHandle _heh)
Construct with mesh and start halfedge.
Definition: circulators_template.hh:49
CirculatorT::operator->
pointer operator->() const
Return a pointer to the current target.
Definition: circulators_template.hh:165
CirculatorT::operator=
CirculatorT & operator=(const CirculatorT< Mesh > &_rhs)
Assignment operator.
Definition: circulators_template.hh:67
CirculatorT::operator!=
bool operator!=(const CirculatorT &_rhs) const
Not equal ?
Definition: circulators_template.hh:111
CirculatorT
Circulator.
Definition: circulators_template.hh:9
CirculatorT::operator==
bool operator==(const CirculatorT &_rhs) const
Equal ?
Definition: circulators_template.hh:102
OpenMesh::PolyMesh_ArrayKernelT
Polygonal mesh based on the ArrayKernel.
Definition: PolyMesh_ArrayKernelT.hh:99