diff --git a/Triangulation_3/doc_tex/TriangulationDS_3_ref/TriangulationDataStructure_3.tex b/Triangulation_3/doc_tex/TriangulationDS_3_ref/TriangulationDataStructure_3.tex index 54d2d40370a..bcbcef7fc5e 100644 --- a/Triangulation_3/doc_tex/TriangulationDS_3_ref/TriangulationDataStructure_3.tex +++ b/Triangulation_3/doc_tex/TriangulationDS_3_ref/TriangulationDataStructure_3.tex @@ -100,6 +100,21 @@ Requirements for \ccc{Vertex} and \ccc{Cell} are described in \ccRefPage{TriangulationDataStructure_3::Vertex} and \ccRefPage{TriangulationDataStructure_3::Cell})}. +\begin{ccAdvanced} +\ccNestedType{template struct Rebind_vertex} +{This nested template class allows to get the type of a triangulation +data structure that only changes the vertex type. It has to define a type +\ccc{Other} which is a {\it rebound} triangulation data structure, that is, the +one whose \ccc{TriangulationDSVertexBase_3} will be \ccc{Vb2}.} +\ccGlue +\ccNestedType{template struct Rebind_cell} +{This nested template class allows to get the type of a triangulation +data structure that only changes the cell type. It has to define a type +\ccc{Other} which is a {\it rebound} triangulation data structure, that is, the +one whose \ccc{TriangulationDSCellBase_3} will be \ccc{Cb2}.} +\end{ccAdvanced} + + \ccTypedef{typedef Triple Edge;}{\ccc{(c,i,j)} is the edge of cell \ccc{c} whose vertices indices are \ccc{i} and \ccc{j}. (See Section~\ref{TDS3-sec-intro}.)} diff --git a/Triangulation_3/include/CGAL/Triangulation_data_structure_3.h b/Triangulation_3/include/CGAL/Triangulation_data_structure_3.h index 2cc9927a193..2b724569d9a 100644 --- a/Triangulation_3/include/CGAL/Triangulation_data_structure_3.h +++ b/Triangulation_3/include/CGAL/Triangulation_data_structure_3.h @@ -60,6 +60,18 @@ class Triangulation_data_structure_3 public: + // Tools to change the Vertex and Cell types of the TDS. + template < typename Vb2 > + struct Rebind_vertex { + typedef Triangulation_data_structure_3 Other; + }; + + template < typename Cb2 > + struct Rebind_cell { + typedef Triangulation_data_structure_3 Other; + }; + + // Put this TDS inside the Vertex and Cell types. typedef typename Vb::template Rebind_TDS::Other Vertex; typedef typename Cb::template Rebind_TDS::Other Cell; diff --git a/Triangulation_3/test/Triangulation_3/include/CGAL/_test_cls_tds_3.h b/Triangulation_3/test/Triangulation_3/include/CGAL/_test_cls_tds_3.h index 62005fd46dd..a9fd98ee9d5 100644 --- a/Triangulation_3/test/Triangulation_3/include/CGAL/_test_cls_tds_3.h +++ b/Triangulation_3/test/Triangulation_3/include/CGAL/_test_cls_tds_3.h @@ -25,6 +25,9 @@ #include "_test_cls_tds_vertex.h" #include "_test_cls_tds_cell.h" +#include +#include + template void _test_cls_tds_3( const Tds &) @@ -44,6 +47,15 @@ _test_cls_tds_3( const Tds &) typedef typename Tds::Cell_handle Cell_handle; typedef typename Tds::Cell_iterator Cell_iterator; + // test rebinds : + typedef CGAL::Triangulation_cell_base_with_info_3 New_cell_base; + // I can't rebind the vertex that easily as the with_info needs a Point... :( + // so let's fake a rebind vertex. + // typedef CGAL::Triangulation_vertex_base_with_info_3 New_vertex_base; + + typedef typename Tds::template Rebind_vertex::Other New_TDS_1; + typedef typename New_TDS_1::template Rebind_cell::Other New_TDS; + // test Vertex and cell : std::cout << " Test Vertex " << std::endl; _test_vertex_tds_3(Vertex());