% ============================================================================= % The CGAL Developers' Manual % Chapter: Introduction % ----------------------------------------------------------------------------- % file : overall_design.tex % authors: Stefan Schirra % ----------------------------------------------------------------------------- % $Revision$ % $Date$ % ============================================================================= \section{The overall design} \label{sec:overall_design} \ccIndexMainItem{design} The design goals, especially flexibility and efficient robust computation, have led us to opt for the generic programming paradigm using templates in \CC.\footnote{In appropriate places, however, \cgal\ does and should make use of object-oriented solutions and design patterns, as well.} In the overall design of \cgal\ two major layers can be identified, the layer of algorithms and data structures and the kernel layer (Figure~\ref{fig:genericCGAL}). \ccIndexMainItem{kernel} \begin{figure} \begin{ccTexOnly} \begin{center} \leavevmode \epsfxsize=11cm \epsffile{pictures/generic_cgal.eps} \end{center} \end{ccTexOnly} \caption{The generic design of \cgal. \label{fig:genericCGAL}} \begin{ccHtmlOnly}
Generic design of CGAL
\end{ccHtmlOnly} \end{figure} Algorithms and data structures in \cgal\ are parameterized by the types of objects and operations they use. They work with any concrete template arguments that fulfill certain syntactical as well as semantic requirements. In order to avoid long parameter lists, the parameter types are collected into a single class, called the traits class in \cgal\ccIndexMainItem{traits class} (Chapter \ref{chap:traits_classes}.) A {\em concept}\ccIndexMainItemDef{concepts} is an abstraction of a type defined by a set of requirements. Any concrete type is called a {\em model}\ccIndexMainItemDef{model} for a concept if it fulfills the set of requirements corresponding to the concept. Using this terminology, we can say a \cgal\ algorithm or data structure comes with a traits concept and can be used with any concrete traits model for this concept. Further contributions to \cgal\ should continue the current high level of genericity. \cgal\ defines the concept of a geometry kernel.% \ccIndexSubitem{kernel}{concept} Ideally, any model for this concept can be used with any \cgal\ algorithm. This holds, of course, only if the requirements of an algorithm or data structure on its traits class are subsumed by the kernel concepts, {\em i.e.}, if an algorithm or data structure has no special requirements not covered in the definition of the kernel concept. \cgal\ currently provides four models for the \cgal\ 2D and 3D kernel concept. Those are again parameterized and differ in their representation of the geometric objects and the exchangeability of the types involved. In all cases the kernels are parameterized by a number type, which is used to store coordinates and which determines the basic arithmetic of the kernel primitives. See Chapter~\ref{chap:kernels} for more details. There are further complementary layers in \cgal. The most basic layer is the configuration layer.\ccIndexMainItem{configuration layer} This layer takes care of setting configuration flags according to the outcome of tests run during installation. The {\em support library} layer \ccIndexMainItemDef{support library} is documented in the \ccAnchor{http://www.cgal.org/Manual/doc_html/frameset/fsSupport.html}{Support Library Reference Manual} and contains packages that deal with things such as visualization, number types, streams, and \stl\ extensions in \cgal. %\lcTex{\Ipe{/KM/usr/schirra/Work/Trends/Konstanz/libstructure.ipe}}