44 #ifndef OPENMESH_AutoPropertyHandleT_HH 45 #define OPENMESH_AutoPropertyHandleT_HH 57 template <
class Mesh_,
class PropertyHandle_>
62 typedef PropertyHandle_ PropertyHandle;
63 typedef PropertyHandle Base;
64 typedef typename PropertyHandle::Value Value;
73 : m_(
nullptr), own_property_(
false)
77 : Base(_other.idx()), m_(_other.m_), own_property_(
false)
81 { add_property(_m, _pp_name); }
84 : Base(_pph.idx()), m_(&_m), own_property_(
false)
91 m_->remove_property(*
this);
95 inline void add_property(Mesh& _m,
const std::string& _pp_name = std::string())
99 own_property_ = _pp_name.empty() || !m_->get_property_handle(*
this, _pp_name);
102 m_->add_property(*
this, _pp_name);
106 inline void remove_property()
108 assert(own_property_);
109 m_->remove_property(*
this);
110 own_property_ =
false;
114 template <
class _Handle>
115 inline Value& operator [] (_Handle _hnd)
116 {
return m_->property(*
this, _hnd); }
118 template <
class _Handle>
119 inline const Value& operator [] (_Handle _hnd)
const 120 {
return m_->property(*
this, _hnd); }
122 inline bool own_property()
const 123 {
return own_property_; }
125 inline void free_property()
126 { own_property_ =
false; }
132 #endif // OPENMESH_AutoPropertyHandleT_HH defined