diff --git a/STL_Extension/include/CGAL/Hidden_point_memory_policy.h b/STL_Extension/include/CGAL/Hidden_point_memory_policy.h new file mode 100644 index 00000000000..6552881514e --- /dev/null +++ b/STL_Extension/include/CGAL/Hidden_point_memory_policy.h @@ -0,0 +1,35 @@ +// Copyright (c) 2017 INRIA Sophia-Antipolis (France). +// All rights reserved. +// +// This file is part of CGAL (www.cgal.org); you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public License as +// published by the Free Software Foundation; either version 3 of the License, +// or (at your option) any later version. +// +// Licensees holding a valid commercial license may use this file in +// accordance with the commercial license agreement provided with the software. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. +// +// Author(s) : Mael Rouxel-Labbé + +#ifndef CGAL_HIDDEN_POINT_MEMORY_POLICY_H +#define CGAL_HIDDEN_POINT_MEMORY_POLICY_H + +#include + +namespace CGAL { + +// A policy to select whether hidden points should be cached in cells or discarded +// during the construction of a regular triangulation. + +template < typename Tag > +struct Hidden_points_memory_policy : public Tag { }; + +typedef Hidden_points_memory_policy Keep_hidden_points; +typedef Hidden_points_memory_policy Discard_hidden_points; + +} // namespace CGAL + +#endif // CGAL_HIDDEN_POINT_MEMORY_POLICY_H diff --git a/Triangulation_3/include/CGAL/Regular_triangulation_cell_base_3.h b/Triangulation_3/include/CGAL/Regular_triangulation_cell_base_3.h index 2d19ca3ed46..c69318558ac 100644 --- a/Triangulation_3/include/CGAL/Regular_triangulation_cell_base_3.h +++ b/Triangulation_3/include/CGAL/Regular_triangulation_cell_base_3.h @@ -25,20 +25,23 @@ #include +#include +#include + +#include #include -#include namespace CGAL { template < typename GT, typename Cb = Triangulation_cell_base_3, + typename Memory_policy = Keep_hidden_points, typename C = std::list > class Regular_triangulation_cell_base_3 : public Cb { public: - static const bool DO_HIDE_POINT = true; typedef typename Cb::Vertex_handle Vertex_handle; typedef typename Cb::Cell_handle Cell_handle; @@ -53,8 +56,8 @@ public: template < typename TDS2 > struct Rebind_TDS { - typedef typename Cb::template Rebind_TDS::Other Cb2; - typedef Regular_triangulation_cell_base_3 Other; + typedef typename Cb::template Rebind_TDS::Other Cb2; + typedef Regular_triangulation_cell_base_3 Other; }; Regular_triangulation_cell_base_3() @@ -76,14 +79,45 @@ public: Cell_handle n3) : Cb(v0, v1, v2, v3, n0, n1, n2, n3) {} - Point_iterator hidden_points_begin() { return _hidden.begin(); } - Point_iterator hidden_points_end() { return _hidden.end(); } + // Memory_policy is Tag_true ------------------------------------------------- + template + Point_iterator hidden_points_begin(typename boost::enable_if_c::type* = NULL) + { return _hidden.begin(); } + template + Point_iterator hidden_points_end(typename boost::enable_if_c::type* = NULL) + { return _hidden.end(); } - Point_const_iterator hidden_points_begin() const { return _hidden.begin(); } - Point_const_iterator hidden_points_end() const { return _hidden.end(); } + // const versions + template + Point_const_iterator hidden_points_begin(typename boost::enable_if_c::type* = NULL) const + { return _hidden.begin(); } + template + Point_const_iterator hidden_points_end(typename boost::enable_if_c::type* = NULL) const + { return _hidden.end(); } - void hide_point (const Weighted_point &p) { _hidden.push_back(p); } - // void unhide_point (Point_iterator i) { _hidden.delete(i); } + template + void hide_point(const Weighted_point& p, typename boost::enable_if_c::type* = NULL) + { _hidden.push_back(p); } + + // Memory_policy is Tag_false ------------------------------------------------ + template + Point_iterator hidden_points_begin(typename boost::disable_if_c::type* = NULL) + { return hidden_points_end(); } + template + Point_iterator hidden_points_end(typename boost::disable_if_c::type* = NULL) + { return _hidden.end(); } + + // const versions + template + Point_const_iterator hidden_points_begin(typename boost::disable_if_c::type* = NULL) const + { return hidden_points_end(); } + template + Point_const_iterator hidden_points_end(typename boost::disable_if_c::type* = NULL) const + { return _hidden.end(); } + + template + void hide_point(const Weighted_point&, typename boost::disable_if_c::type* = NULL) + { } //note this function is not requested by the RegularTriangulationCellBase_3 //it should be replaced everywhere by weighted_circumcenter()