mirror of https://github.com/CGAL/cgal
Add a Rebind_vertex and a Rebind_cell to the TDS that allow to get new TDS types
with changes vertex/cell types. Documented as advanced in the TDS concept.
This commit is contained in:
parent
7bd49ac8f1
commit
7f61ffff50
|
|
@ -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 <typename Vb2> 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 <typename Cb2> 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<Cell_handle, int, int> 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}.)}
|
||||
|
|
|
|||
|
|
@ -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<Vb2, Cb> Other;
|
||||
};
|
||||
|
||||
template < typename Cb2 >
|
||||
struct Rebind_cell {
|
||||
typedef Triangulation_data_structure_3<Vb, Cb2> Other;
|
||||
};
|
||||
|
||||
// Put this TDS inside the Vertex and Cell types.
|
||||
typedef typename Vb::template Rebind_TDS<Tds>::Other Vertex;
|
||||
typedef typename Cb::template Rebind_TDS<Tds>::Other Cell;
|
||||
|
||||
|
|
|
|||
|
|
@ -25,6 +25,9 @@
|
|||
#include "_test_cls_tds_vertex.h"
|
||||
#include "_test_cls_tds_cell.h"
|
||||
|
||||
#include <CGAL/Triangulation_vertex_base_with_info_3.h>
|
||||
#include <CGAL/Triangulation_cell_base_with_info_3.h>
|
||||
|
||||
template <class Tds>
|
||||
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<double, Cell> 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<double, Vertex> New_vertex_base;
|
||||
|
||||
typedef typename Tds::template Rebind_vertex<Vertex>::Other New_TDS_1;
|
||||
typedef typename New_TDS_1::template Rebind_cell<New_cell_base>::Other New_TDS;
|
||||
|
||||
// test Vertex and cell :
|
||||
std::cout << " Test Vertex " << std::endl;
|
||||
_test_vertex_tds_3(Vertex());
|
||||
|
|
|
|||
Loading…
Reference in New Issue