BWAPI
|
00001 // Copyright (c) 2006-2007 Max-Planck-Institute Saarbruecken (Germany). 00002 // All rights reserved. 00003 // 00004 // This file is part of CGAL (www.cgal.org); you can redistribute it and/or 00005 // modify it under the terms of the GNU Lesser General Public License as 00006 // published by the Free Software Foundation; version 2.1 of the License. 00007 // See the file LICENSE.LGPL distributed with CGAL. 00008 // 00009 // Licensees holding a valid commercial license may use this file in 00010 // accordance with the commercial license agreement provided with the software. 00011 // 00012 // This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE 00013 // WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. 00014 // 00015 // $URL: svn+ssh://scm.gforge.inria.fr/svn/cgal/branches/CGAL-3.5-branch/Algebraic_foundations/include/CGAL/Algebraic_extension_traits.h $ 00016 // $Id: Algebraic_extension_traits.h 44362 2008-07-23 14:58:05Z hoffmann $ 00017 // 00018 // 00019 // Author(s) : Michael Hemmer <hemmer@mpi-inf.mpg.de> 00020 // 00021 // ============================================================================= 00022 00023 00028 #ifndef CGAL_ALGEBRAIC_NUMBER_TRAITS_H 00029 #define CGAL_ALGEBRAIC_NUMBER_TRAITS_H 1 00030 00031 #include <numeric> // for std::accumulate 00032 00033 CGAL_BEGIN_NAMESPACE 00034 00035 template< class T > 00036 class Algebraic_extension_traits { 00037 public: 00040 typedef T Type; 00042 typedef CGAL::Tag_false Is_extended; 00043 00045 // multiplication 00046 class Normalization_factor 00047 : public std::unary_function<Type,Type> { 00048 private: 00049 static Type 00050 normalization_factor(const Type&,Integral_domain_without_division_tag){ 00051 return Type(1); 00052 } 00053 static Type 00054 normalization_factor(const Type& a, Field_tag){ 00055 return Type(1)/a; 00056 } 00057 public: 00059 Type operator () (const Type& a) { 00060 CGAL_precondition(a != Type(0)); 00061 typedef typename Algebraic_structure_traits<Type>::Algebraic_category 00062 Tag; 00063 return normalization_factor(a, Tag()); 00064 } 00065 }; 00066 00067 class Denominator_for_algebraic_integers 00068 : public std::unary_function<Type,Type> { 00069 public: 00071 Type operator () (const Type&) { 00072 return Type(1); 00073 } 00074 00075 template <class InputIterator> 00076 Type operator () (InputIterator, InputIterator) { 00077 return Type(1); 00078 } 00079 }; 00080 }; 00081 00082 CGAL_END_NAMESPACE 00083 00084 #endif // NiX_ALGEBRAIC_NUMBER_TRAITS_H 00085 // EOF