From a9c35e17de445e3c07f46dbbb8da61bf19f5d7f9 Mon Sep 17 00:00:00 2001 From: Simon Giraudot Date: Mon, 12 Sep 2016 15:18:51 +0200 Subject: [PATCH] Reintroduce difference between pmap and push_pmap --- Point_set_3/include/CGAL/Point_set_3.h | 65 ++++++++++++++++++++++---- 1 file changed, 55 insertions(+), 10 deletions(-) diff --git a/Point_set_3/include/CGAL/Point_set_3.h b/Point_set_3/include/CGAL/Point_set_3.h index f9e55dc9974..f04c50eb6ef 100644 --- a/Point_set_3/include/CGAL/Point_set_3.h +++ b/Point_set_3/include/CGAL/Point_set_3.h @@ -106,7 +106,7 @@ public: }; template - class Property_pmap + class Push_pmap { public: typedef std::size_t key_type; @@ -118,12 +118,12 @@ public: Property* prop; mutable std::size_t ind; - Property_pmap(Point_set* ps = NULL, - Property* prop = NULL, - std::size_t ind=0) + Push_pmap(Point_set* ps = NULL, + Property* prop = NULL, + std::size_t ind=0) : ps(ps), prop(prop), ind(ind) {} - friend void put(const Property_pmap& pm, std::size_t& i, const typename Property::value_type& t) + friend void put(const Push_pmap& pm, std::size_t& i, const typename Property::value_type& t) { if(pm.ps->size() <= (pm.ind)) pm.ps->add_item(); @@ -132,6 +132,34 @@ public: ++pm.ind; } + friend const reference get (const Push_pmap& pm, const std::size_t& i) + { + return ((*(pm.prop))[i]); + } + }; + + + template + class Property_pmap + { + public: + typedef std::size_t key_type; + typedef typename Property::value_type value_type; + typedef value_type& reference; + typedef boost::lvalue_property_map_tag category; + + Point_set* ps; + Property* prop; + + Property_pmap(Point_set* ps = NULL, + Property* prop = NULL) + : ps(ps), prop(prop) {} + + friend void put(const Property_pmap& pm, std::size_t& i, const typename Property::value_type& t) + { + (*(pm.prop))[i] = t; + } + friend const reference get (const Property_pmap& pm, const std::size_t& i) { return ((*(pm.prop))[i]); @@ -163,9 +191,14 @@ public: typedef Property_back_inserter Index_back_inserter; typedef Property_back_inserter Point_back_inserter; - typedef Const_property_pmap Const_point_pmap; + + typedef Push_pmap Point_push_pmap; typedef Property_pmap Point_pmap; - typedef Property_pmap Normal_pmap; + typedef Const_property_pmap Const_point_pmap; + + typedef Push_pmap Vector_push_pmap; + typedef Property_pmap Vector_pmap; + typedef Const_property_pmap Const_vector_pmap; protected: @@ -304,18 +337,30 @@ public: return Point_back_inserter (this, &m_points, size()); } + Point_push_pmap point_push_pmap () + { + return Point_push_pmap (this, &m_points, size()); + } Point_pmap point_pmap () { - return Point_pmap (this, &m_points, size()); + return Point_pmap (this, &m_points); } Const_point_pmap point_pmap () const { return Const_point_pmap (this, &m_points); } - Normal_pmap normal_pmap () + Vector_pmap normal_pmap () { - return Normal_pmap (this, &m_normals, size()); + return Vector_pmap (this, &m_normals); + } + Vector_push_pmap normal_push_pmap () + { + return Vector_push_pmap (this, &m_normals, size()); + } + Const_vector_pmap normal_pmap () const + { + return Const_vector_pmap (this, &m_points); }