diff --git a/.gitattributes b/.gitattributes index 303437a8456..2f8ff80f0fb 100644 --- a/.gitattributes +++ b/.gitattributes @@ -2418,6 +2418,7 @@ Number_types/include/CGAL/Sqrt_extension/Algebraic_extension_traits.h -text Number_types/include/CGAL/Sqrt_extension/Algebraic_structure_traits.h -text Number_types/include/CGAL/Sqrt_extension/Coercion_traits.h -text Number_types/include/CGAL/Sqrt_extension/Fraction_traits.h -text +Number_types/include/CGAL/Sqrt_extension/Get_arithmetic_kernel.h -text Number_types/include/CGAL/Sqrt_extension/Modular_traits.h -text Number_types/include/CGAL/Sqrt_extension/Real_embeddable_traits.h -text Number_types/include/CGAL/Sqrt_extension/Scalar_factor_traits.h -text @@ -2890,6 +2891,7 @@ Polynomial/examples/Polynomial/substitute.cpp -text Polynomial/examples/Polynomial/swap_move.cpp -text Polynomial/include/CGAL/Polynomial/Coercion_traits.h -text Polynomial/include/CGAL/Polynomial/Degree.h -text +Polynomial/include/CGAL/Polynomial/Get_arithmetic_kernel.h -text Polynomial/include/CGAL/Polynomial/Monomial_representation.h -text Polynomial/include/CGAL/Polynomial/bezout_matrix.h -text Polynomial/include/CGAL/Polynomial/determinant.h -text @@ -2902,6 +2904,7 @@ Polynomial/include/CGAL/Polynomial/subresultants.h -text Polynomial/include/CGAL/Polynomial_type_generator.h -text Polynomial/include/CGAL/Test/_test_polynomial_traits_d.h -text Polynomial/test/Polynomial/Coercion_traits.cpp -text +Polynomial/test/Polynomial/Get_arithmetic_kernel.cpp -text Polynomial/test/Polynomial/Polynomial_type_generator.cpp -text Polynomial/test/Polynomial/polynomial_utils.cpp -text Polynomial/test/Polynomial/sturm_habicht_sequence.cpp -text diff --git a/Arithmetic_kernel/include/CGAL/Get_arithmetic_kernel.h b/Arithmetic_kernel/include/CGAL/Get_arithmetic_kernel.h index c110bde7faf..c22b52ab017 100644 --- a/Arithmetic_kernel/include/CGAL/Get_arithmetic_kernel.h +++ b/Arithmetic_kernel/include/CGAL/Get_arithmetic_kernel.h @@ -29,21 +29,6 @@ CGAL_BEGIN_NAMESPACE template< class NT > struct Get_arithmetic_kernel; - -template class Sqrt_extension; -template -struct Get_arithmetic_kernel >{ - typedef Get_arithmetic_kernel GET; - typedef typename GET::Arithmetic_kernel Arithmetic_kernel; -}; - -template class Polynomial; -template -struct Get_arithmetic_kernel >{ - typedef Get_arithmetic_kernel GET; - typedef typename GET::Arithmetic_kernel Arithmetic_kernel; -}; - CGAL_END_NAMESPACE #endif // CGAL_GET_ARITHMETIC_KERNEL_H diff --git a/Number_types/include/CGAL/Sqrt_extension.h b/Number_types/include/CGAL/Sqrt_extension.h index 9a885313976..76d9d8d4cb0 100644 --- a/Number_types/include/CGAL/Sqrt_extension.h +++ b/Number_types/include/CGAL/Sqrt_extension.h @@ -62,6 +62,7 @@ factorization property. #include #include #include +#include #endif // CGAL_SQRT_EXTENSION_H diff --git a/Number_types/include/CGAL/Sqrt_extension/Get_arithmetic_kernel.h b/Number_types/include/CGAL/Sqrt_extension/Get_arithmetic_kernel.h new file mode 100644 index 00000000000..07c0266332f --- /dev/null +++ b/Number_types/include/CGAL/Sqrt_extension/Get_arithmetic_kernel.h @@ -0,0 +1,38 @@ +// Copyright (c) 2006-2008 Max-Planck-Institute Saarbruecken (Germany). +// All rights reserved. +// +// This file is part of CGAL (www.cgal.org); you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public License as +// published by the Free Software Foundation; version 2.1 of the License. +// See the file LICENSE.LGPL 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: svn+ssh://hemmer@scm.gforge.inria.fr/svn/cgal/trunk/Number_types/include/CGAL/Sqrt_extension/Scalar_factor_traits.h $ +// $Id: Scalar_factor_traits.h 52628 2009-10-20 08:59:26Z lrineau $ +// +// +// Author(s) : Michael Hemmer + + +#ifndef CGAL_SQRT_EXTENSION_GET_ARITHMETIC_KERNEL_H +#define CGAL_SQRT_EXTENSION_GET_ARITHMETIC_KERNEL_H + +#include +#include + +CGAL_BEGIN_NAMESPACE + +template +struct Get_arithmetic_kernel >{ + typedef Get_arithmetic_kernel GET; + typedef typename GET::Arithmetic_kernel Arithmetic_kernel; +}; + +CGAL_END_NAMESPACE + +#endif diff --git a/Number_types/test/Number_types/Sqrt_extension.cpp b/Number_types/test/Number_types/Sqrt_extension.cpp index 104afa64b6b..26b86888aae 100644 --- a/Number_types/test/Number_types/Sqrt_extension.cpp +++ b/Number_types/test/Number_types/Sqrt_extension.cpp @@ -706,6 +706,26 @@ void test_algebraic_extension_traits(){ } } +template +void test_get_arithmetic_kernel(){ + typedef CGAL::Arithmetic_kernel AK; + typedef AK::Integer Integer; + typedef AK::Rational Rational; + { + typedef CGAL::Sqrt_extension EXT; + typedef CGAL::Get_arithmetic_kernel::Arithmetic_kernel AK_; + BOOST_STATIC_ASSERT((boost::is_same::value)); + } { + typedef CGAL::Sqrt_extension EXT; + typedef CGAL::Get_arithmetic_kernel::Arithmetic_kernel AK_; + BOOST_STATIC_ASSERT((boost::is_same::value)); + } { + typedef CGAL::Sqrt_extension EXT; + typedef CGAL::Get_arithmetic_kernel::Arithmetic_kernel AK_; + BOOST_STATIC_ASSERT((boost::is_same::value)); + } +} + template void sqrt_extension_test(){ CGAL_SNAP_ARITHMETIC_KERNEL_TYPEDEFS(AT); @@ -724,6 +744,8 @@ void sqrt_extension_test(){ scalar_factor_traits_test(); test_algebraic_extension_traits(); + + test_get_arithmetic_kernel(); } int main(){ diff --git a/Polynomial/include/CGAL/Polynomial.h b/Polynomial/include/CGAL/Polynomial.h index c84bd05d564..cd523c07b1e 100644 --- a/Polynomial/include/CGAL/Polynomial.h +++ b/Polynomial/include/CGAL/Polynomial.h @@ -65,6 +65,7 @@ #include #include #include +#include // TODO: Are these still includes necessary? #include // used above for Algebraic_structure_traits::Gcd diff --git a/Polynomial/include/CGAL/Polynomial/Get_arithmetic_kernel.h b/Polynomial/include/CGAL/Polynomial/Get_arithmetic_kernel.h new file mode 100644 index 00000000000..22ece093a6c --- /dev/null +++ b/Polynomial/include/CGAL/Polynomial/Get_arithmetic_kernel.h @@ -0,0 +1,38 @@ +// Copyright (c) 2006-2008 Max-Planck-Institute Saarbruecken (Germany). +// All rights reserved. +// +// This file is part of CGAL (www.cgal.org); you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public License as +// published by the Free Software Foundation; version 2.1 of the License. +// See the file LICENSE.LGPL 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: svn+ssh://hemmer@scm.gforge.inria.fr/svn/cgal/trunk/Number_types/include/CGAL/Sqrt_extension/Scalar_factor_traits.h $ +// $Id: Scalar_factor_traits.h 52628 2009-10-20 08:59:26Z lrineau $ +// +// +// Author(s) : Michael Hemmer + + +#ifndef CGAL_POLYNOMIAL_GET_ARITHMETIC_KERNEL_H +#define CGAL_POLYNOMIAL_GET_ARITHMETIC_KERNEL_H + +#include +#include + +CGAL_BEGIN_NAMESPACE + +template +struct Get_arithmetic_kernel >{ + typedef Get_arithmetic_kernel GET; + typedef typename GET::Arithmetic_kernel Arithmetic_kernel; +}; + +CGAL_END_NAMESPACE + +#endif diff --git a/Polynomial/test/Polynomial/Get_arithmetic_kernel.cpp b/Polynomial/test/Polynomial/Get_arithmetic_kernel.cpp new file mode 100644 index 00000000000..27a3247395c --- /dev/null +++ b/Polynomial/test/Polynomial/Get_arithmetic_kernel.cpp @@ -0,0 +1,31 @@ +#include +#include +#include + +template +void test_get_arithmetic_kernel(){ + typedef CGAL::Arithmetic_kernel AK; + typedef AK::Integer Integer; + { + typedef CGAL::Polynomial POLY; + typedef CGAL::Get_arithmetic_kernel::Arithmetic_kernel AK_; + BOOST_STATIC_ASSERT((boost::is_same::value)); + }{ + typedef CGAL::Polynomial > POLY; + typedef CGAL::Get_arithmetic_kernel::Arithmetic_kernel AK_; + BOOST_STATIC_ASSERT((boost::is_same::value)); + } +} + +int main(){ +#ifdef CGAL_USE_LEDA + test_get_arithmetic_kernel(); +#endif // CGAL_USE_LEDA + +#ifdef CGAL_USE_CORE + test_get_arithmetic_kernel(); +#endif // CGAL_USE_CORE + return 0; +} + +