// Copyright (c) 2008 Max-Planck-Institute Saarbruecken (Germany) // // 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; either version 3 of the License, // or (at your option) any later version. // // 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$ // SPDX-License-Identifier: LGPL-3.0+ // // // Author(s) : Arno Eigenwillig // Michael Hemmer // // ============================================================================ // TODO: The comments are all original EXACUS comments and aren't adapted. So // they may be wrong now. #ifndef CGAL_POLYNOMIAL_REAL_EMBEDDABLE_TRAITS_H #define CGAL_POLYNOMIAL_REAL_EMBEDDABLE_TRAITS_H #include namespace CGAL { namespace internal { template< class Polynomial , class TAG> class Real_embeddable_traits_poly_base; template< class NT , class TAG> class Real_embeddable_traits_poly_base< Polynomial, TAG > : public INTERN_RET::Real_embeddable_traits_base< Polynomial , CGAL::Tag_false > {}; // Real embeddable traits // TODO: Polynomials aren't Real_embeddable! But for debugging and testing // reasons, the real embeddable functors are provided. template< class NT > class Real_embeddable_traits_poly_base< Polynomial, CGAL::Tag_true > : public INTERN_RET::Real_embeddable_traits_base< Polynomial , CGAL::Tag_false > { public: typedef Tag_false Is_real_embeddable; class Abs { public: typedef Polynomial argument_type; typedef Polynomial result_type; Polynomial operator()( const Polynomial& x ) const { return x.abs(); } }; class Sgn { public: typedef Polynomial argument_type; typedef CGAL::Sign result_type; CGAL::Sign operator()( const Polynomial& x ) const { return x.sign(); } }; class Compare { public: typedef Polynomial first_argument_type; typedef Polynomial second_argument_type; typedef CGAL::Comparison_result result_type; CGAL::Comparison_result operator()( const Polynomial& x, const Polynomial& y ) const { return x.compare(y); } CGAL_IMPLICIT_INTEROPERABLE_BINARY_OPERATOR_WITH_RT( Polynomial, CGAL::Comparison_result ) }; class To_double { public: typedef typename Real_embeddable_traits::To_double NT_to_double; typedef Polynomial result_type; typedef Polynomial argument_type; result_type operator()( const Polynomial& x ) const { CGAL_precondition(x.degree() >= 0); NT_to_double to_double; return result_type( ::boost::make_transform_iterator(x.begin(),to_double), ::boost::make_transform_iterator(x.end() ,to_double)); } }; class To_interval { public: typedef typename Real_embeddable_traits::To_interval NT_to_interval; typedef Polynomial result_type; typedef Polynomial argument_type; result_type operator()( const Polynomial& x ) const { CGAL_precondition( x.degree() >= 0 ); NT_to_interval to_interval; return result_type( ::boost::make_transform_iterator(x.begin(),to_interval), ::boost::make_transform_iterator(x.end() ,to_interval)); } }; }; } // namespace internal template class Real_embeddable_traits > :public internal::Real_embeddable_traits_poly_base< Polynomial, typename Real_embeddable_traits::Type>::Is_real_embeddable> {}; } //namespace CGAL #endif // CGAL_POLYNOMIAL_REAL_EMBEDDABLE_TRAITS_H