![]() |
The classes CGAL::HalfedgeDS_items_decorator<HDS>, CGAL::HalfedgeDS_decorator<HDS>, and CGAL::HalfedgeDS_const_decorator<HDS> provide additional functions to examine and to modify a halfedge data structure HDS. The class CGAL::HalfedgeDS_items_decorator<HDS> provides additional functions for vertices, halfedges, and faces of a halfedge data structure without knowing the containing halfedge data structure. The class CGAL::HalfedgeDS_decorator<HDS> stores a reference to the halfedge data structure and provides functions that modify the halfedge data structure, for example Euler-operators. The class CGAL::HalfedgeDS_const_decorator<HDS> stores a const reference to the halfedge data structure. It contains non-modifying functions, for example the test for validness of the data structure.
All these additional functions take care of the different capabilities a halfedge data structure may have or may not have. The functions evaluate the type tags of the halfedge data structure to decide on the actions. If a particular feature is not supported nothing is done. Note that for example the creation of new halfedges is mandatory for all halfedge data structures and will not appear here again.
#include <CGAL/HalfedgeDS_const_decorator.h>
CGAL::HalfedgeDS_items_decorator<HDS>
|
| |
|
keeps internally a const reference to hds.
| |
A halfedge data structure has no definition of validness of its own, but a useful set of tests is defined with the following levels:
CGAL::HalfedgeDS_items_decorator<HDS>
CGAL::HalfedgeDS_decorator<HDS>
The following program fragment illustrates the implementation of a is_valid() member function for a simplified polyhedron class. We assume here that the level three check is the appropriate default for polyhedral surfaces.
namespace CGAL {
template <class Traits>
class Polyhedron {
typedef HalfedgeDS_default<Traits> HDS;
HDS hds;
public:
// ...
bool is_valid( bool verb = false, int level = 0) const {
Verbose_ostream verr(verb);
verr << "begin Polyhedron::is_valid( verb=true, level = " << level
<< "):" << std::endl;
HalfedgeDS_const_decorator<HDS> decorator(hds);
bool valid = decorator.is_valid( verb, level + 3);
// further checks ...
}
};
}