// Copyright (c) 2003-2006 INRIA Sophia-Antipolis (France). // All rights reserved. // // This file is part of CGAL (www.cgal.org); you may redistribute it under // the terms of the Q Public License version 1.0. // See the file LICENSE.QPL distributed with CGAL. // // Licensees holding a valid commercial license may use this file in // accordance with the commercial license agreement provided with the software. // // This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE // WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. // // $URL$ // $Id$ // // Author(s) : Monique Teillaud, Sylvain Pion // Andreas Fabri, Constantinos Tsirogiannis #ifndef CGAL_LAZY_CURVED_KERNEL_H #define CGAL_LAZY_CURVED_KERNEL_H #include #include #include #include #include #include #include #include #include #include #include #include #include CGAL_BEGIN_NAMESPACE // Some specializations (move to another file ?) template < typename K1, typename K2 > struct Type_mapper < typename K1::Circular_arc_2, K1, K2 > { typedef typename K2::Circular_arc_2 type; }; template < typename K1, typename K2 > struct Type_mapper < typename K1::Circular_arc_point_2, K1, K2 > { typedef typename K2::Circular_arc_point_2 type; }; template < typename K1, typename K2 > struct Type_mapper < typename K1::Line_arc_2, K1, K2 > { typedef typename K2::Line_arc_2 type; }; // EK = exact kernel that will be made lazy // Kernel = lazy kernel template < typename EK_, typename AK_, typename E2A_, typename Kernel > class Lazy_curved_kernel_base // : public EK::template Base::Type #if 1 : public Lazy_kernel_base< EK_, AK_, E2A_, Lazy_kernel > #endif { // typedef typename EK::template Base::Type Kernel_base; // Hardcoded for now. // typedef Simple_cartesian AK; // An optimiser public: typedef AK_ AK; typedef typename EK_::Algebraic_kernel Algebraic_kernel; // typedef Simple_cartesian > AK; typedef EK_ EK; typedef E2A_ E2A; typedef Approx_converter C2F; typedef Exact_converter C2E; #if 0 typedef typename EK::Algebraic_kernel Al_EK; typedef typename AK::Algebraic_kernel Al_AK; typedef Algebraic_kernel_converter, To_interval > Al_K_converter; typedef typename EK::Linear_kernel Ln_EK; typedef typename AK::Linear_kernel Ln_AK; typedef Cartesian_converter > Ln_converter; // typedef Circular_kernel_converter E2A; //typedef Lazy_kernel Linear_kernel; typedef Lazy_kernel Linear_kernel0; typedef typename Linear_kernel0::template Base::Type Linear_kernel; // should not be needed. #endif template < typename Kernel2 > struct Base { typedef Lazy_curved_kernel_base Type; }; // What to do with the tag ? // Probably this should not exist, should it ? // struct filter_tag{}; // typedef filter_tag Kernel_tag; // typedef typename CK::Kernel_tag Kernel_tag; // typedef typename CK::Rep_tag Rep_tag; //Please remove this if you consider it to be sloppy struct Lazy_tag{}; typedef Lazy_tag Definition_tag; typedef typename EK::Definition_tag Curved_tag; //////////////////////////////////////////////////// // Types typedef CGAL::Lazy_exact_nt FT; typedef FT RT; typedef typename Root_of_traits::RootOf_2 Root_of_2; // typedef Lazy Root_of_2; typedef FT Cartesian_coordinate_type; typedef RT Homogeneous_coordinate_type; //Nothing to do with the curved_k //just for the time being typedef CGAL::Object Object_2; typedef CGAL::Object Object_3; typedef Lazy Circular_arc_2; typedef Lazy Circular_arc_point_2; typedef Lazy Line_arc_2; // typedef Root_for_circles_2_2 Root_for_circles_2_2; typedef int Root_for_circles_2_2; // should AK be filtered ? // We don't touch the predicates. #define CGAL_Curved_Kernel_pred(P, Pf) \ typedef Filtered_predicate< typename EK::P, typename AK::P, C2E, C2F> P; \ P Pf() const { return P(); } // We change the constructions. #define CGAL_Curved_Kernel_cons(C, Cf) \ typedef typename boost::mpl::if_, \ Lazy_construct_intersections_2 , \ typename boost::mpl::if_, \ Lazy_make_x_monotone_2 , \ typename boost::mpl::if_, \ Lazy_make_x_monotone_2 , \ typename boost::mpl::if_, \ Lazy_advanced_make_x_monotone_2 , \ typename boost::mpl::if_, \ Lazy_advanced_make_x_monotone_2 , \ typename boost::mpl::if_, \ Lazy_functor_2_2 , \ typename boost::mpl::if_, \ Lazy_construction_bbox, \ typename boost::mpl::if_,\ Lazy_construction_nt,\ typename boost::mpl::if_,\ Lazy_construction_object,\ Lazy_construction >::type >::type >::type >::type >::type >::type >::type >::type >::type C; \ C Cf() const { return C(); } #include }; template struct Lazy_curved_kernel_adaptor : public Lazy_curved_kernel_base< EK, AK, E2A, Lazy_curved_kernel_adaptor > {}; template struct Lazy_curved_kernel_without_type_equality : public Lazy_curved_kernel_base< EK, AK, E2A, Lazy_curved_kernel_without_type_equality > {}; template , // Algebraic_kernel_2_2 >, class E2A = Circular_kernel_converter >, Algebraic_kernel_converter< typename EK::Algebraic_kernel, typename AK::Algebraic_kernel, To_interval, To_interval > > > struct Lazy_curved_kernel : public Curved_kernel_type_equality_wrapper< Lazy_curved_kernel_base< EK, AK, E2A, Lazy_curved_kernel >, Lazy_curved_kernel > {}; CGAL_END_NAMESPACE #endif // CGAL_LAZY_CURVED_KERNEL_H