Developer Documentation

Notes on template programming

Please note, that OpenMesh makes heavily use of C++ templates, generic programming and all that stuff (see Some words on the C++ implementation). Therefore read this section carefully (else you get lost in the reference manual):

### There is no such thing like the OpenMesh class

The library provides a set of classes ( 99% templates ;-) ), where the inheritance relationship is given by template parameterization. You might ask: "What the heck is that?" It means, a parent class is passed as a template argument to another class:

class P1 { }
class P2 { }
template <typename Parent> class B : public Parent {}
typedef B<P1> fooB1;
typedef B<P2> fooB2;

Voila, we have created two different types of B. Depending on the interface, the public member elements, provided by `P1` or `P2`, `fooB1` and `fooB2` might have different behaviours or even different interfaces! But if `P1` and `P2` have the some interface or at least a common interface, then from programming point of view there is no difference using `fooB1` or `fooB2`. And this is all about. OpenMesh defines an interface concept for the kernel which is documented in OpenMesh::Concepts::KernelT. As long as the kernel provides this the class handling polygonal meshes `OpenMesh::PolyMeshT` can use any kernel.

### Therefore documentation resides in two spaces

1. Associated with the class/struct (as usual)
2. In a concept class in cases like the example code above. Hence, if you want to know what a mesh type has to offer refer to OpenMesh::Concepts::KernelT, OpenMesh::PolyMeshT, OpenMesh::TriMeshT.