Main Page | Modules | Namespace List | Class Hierarchy | Class List | File List | Namespace Members | Class Members | File Members | Related Pages

circulators_template.hh

00001 //== CLASS DEFINITION =========================================================
00002 
00003               
00008 template <class Mesh>
00009 class CirculatorT
00010 {
00011  public:
00012 
00013 
00014   //--- Typedefs ---
00015 
00016   typedef typename Mesh::HalfedgeHandle   HalfedgeHandle;
00017 
00018   typedef TargetType           value_type;
00019   typedef TargetHandle         value_handle;
00020 
00021 #if IsConst
00022   typedef const Mesh&         mesh_ref;
00023   typedef const Mesh*         mesh_ptr;
00024   typedef const TargetType&   reference;
00025   typedef const TargetType*   pointer;
00026 #else
00027   typedef Mesh&               mesh_ref;
00028   typedef Mesh*               mesh_ptr;
00029   typedef TargetType&         reference;
00030   typedef TargetType*         pointer;
00031 #endif
00032 
00033 
00034 
00036   CirculatorT() : mesh_(0), active_(false) {}
00037 
00038 
00040   CirculatorT(mesh_ref _mesh, SourceHandle _start) :
00041     mesh_(&_mesh), 
00042     start_(_mesh.halfedge_handle(_start)),
00043     heh_(start_),
00044     active_(false)
00045   { post_init; }
00046 
00047 
00049   CirculatorT(mesh_ref _mesh, HalfedgeHandle _heh) :
00050     mesh_(&_mesh),
00051     start_(_heh),
00052     heh_(_heh),
00053     active_(false)
00054   { post_init; }
00055 
00056 
00058   CirculatorT(const CirculatorT& _rhs) :
00059     mesh_(_rhs.mesh_),
00060     start_(_rhs.start_),
00061     heh_(_rhs.heh_),
00062     active_(_rhs.active_)
00063   { post_init; }
00064 
00065 
00067   CirculatorT& operator=(const CirculatorT<Mesh>& _rhs)
00068   {
00069     mesh_   = _rhs.mesh_;
00070     start_  = _rhs.start_;
00071     heh_    = _rhs.heh_;
00072     active_ = _rhs.active_;
00073     return *this;
00074   }
00075 
00076 
00077 #if IsConst
00078 
00079   CirculatorT(const NonConstCircT<Mesh>& _rhs) :
00080     mesh_(_rhs.mesh_),
00081     start_(_rhs.start_),
00082     heh_(_rhs.heh_),
00083     active_(_rhs.active_)
00084   { post_init; }
00085 
00086 
00088   CirculatorT& operator=(const NonConstCircT<Mesh>& _rhs)
00089   {
00090     mesh_   = _rhs.mesh_;
00091     start_  = _rhs.start_;
00092     heh_    = _rhs.heh_;
00093     active_ = _rhs.active_;
00094     return *this;
00095   }
00096 #else
00097   friend class ConstCircT<Mesh>;
00098 #endif  
00099 
00100 
00102   bool operator==(const CirculatorT& _rhs) const {
00103     return ((mesh_   == _rhs.mesh_) &&
00104             (start_  == _rhs.start_) &&
00105             (heh_    == _rhs.heh_) &&
00106             (active_ == _rhs.active_));
00107   }
00108 
00109 
00111   bool operator!=(const CirculatorT& _rhs) const {
00112     return !operator==(_rhs);
00113   }
00114 
00115 
00117   CirculatorT& operator++() { 
00118     assert(mesh_);
00119     active_ = true;
00120     increment;
00121     return *this;
00122   }
00123 
00124 
00126   CirculatorT& operator--() { 
00127     assert(mesh_);
00128     active_ = true;
00129     decrement;
00130     return *this;
00131   }
00132 
00133 
00138   HalfedgeHandle current_halfedge_handle() const {
00139     return heh_;
00140   }
00141 
00142 
00144   TargetHandle handle() const {
00145     assert(mesh_);
00146     return get_handle; 
00147   }
00148 
00149 
00151   operator TargetHandle() const {
00152     assert(mesh_);
00153     return get_handle; 
00154   }
00155     
00156 
00158   reference operator*() const { 
00159     assert(mesh_);
00160     return mesh_->deref(handle());
00161   }
00162 
00163 
00165   pointer operator->() const { 
00166     assert(mesh_);
00167     return &mesh_->deref(handle());
00168   }
00169 
00170 
00177   operator bool() const { 
00178     return heh_.is_valid() && ((start_ != heh_) || (!active_));
00179   }
00180 
00181 
00182 private:
00183 
00184   mesh_ptr         mesh_;
00185   HalfedgeHandle   start_, heh_;
00186   bool             active_;
00187 };
00188 
00189 
00190 

acg pic Project OpenMesh, ©  Computer Graphics Group, RWTH Aachen. Documentation generated using doxygen .