From e9553717f018efecc06d7bf05c7d8f59d10ec96e Mon Sep 17 00:00:00 2001 From: Sylvain Pion Date: Thu, 5 Aug 1999 17:29:58 +0000 Subject: [PATCH] - Added "static bool Interval_nt_advanced::want_exceptions = true". - Updated overlap_action() to use it. - Removed the ugly macros CGAL_IA_NO_EXCEPTION and CGAL_IA_NO_WARNING. --- .../include/CGAL/Interval_arithmetic.h | 18 +++++++----------- .../src/Interval_arithmetic.C | 3 ++- 2 files changed, 9 insertions(+), 12 deletions(-) diff --git a/Packages/Interval_arithmetic/include/CGAL/Interval_arithmetic.h b/Packages/Interval_arithmetic/include/CGAL/Interval_arithmetic.h index b0fcca80a90..46b95b95f9e 100644 --- a/Packages/Interval_arithmetic/include/CGAL/Interval_arithmetic.h +++ b/Packages/Interval_arithmetic/include/CGAL/Interval_arithmetic.h @@ -57,18 +57,14 @@ struct Interval_nt_advanced typedef Interval_nt_advanced IA; struct unsafe_comparison {}; // Exception class. static unsigned number_of_failures; // Counts the number of failures. + static bool want_exceptions; // Decide if we throw an exception. - static void overlap_action() // This should be runtime customisable. FIXME -#ifndef CGAL_IA_NO_EXCEPTION - throw (unsafe_comparison) - { number_of_failures++; throw unsafe_comparison(); } -#else -#if !defined(CGAL_IA_NO_WARNINGS) && !defined(CGAL_NO_WARNINGS) - { CGAL_warning_msg(false, " Comparison between overlapping intervals"); } -#else - {} -#endif -#endif // CGAL_IA_NO_EXCEPTION + static void overlap_action() throw (unsafe_comparison) + { + number_of_failures++; + if (want_exceptions) + throw unsafe_comparison(); + } // The constructors. Interval_nt_advanced() {} diff --git a/Packages/Interval_arithmetic/src/Interval_arithmetic.C b/Packages/Interval_arithmetic/src/Interval_arithmetic.C index 5e6ebd14085..306a25f90f3 100644 --- a/Packages/Interval_arithmetic/src/Interval_arithmetic.C +++ b/Packages/Interval_arithmetic/src/Interval_arithmetic.C @@ -25,7 +25,8 @@ CGAL_BEGIN_NAMESPACE -unsigned Interval_nt_advanced::number_of_failures=0; +unsigned Interval_nt_advanced::number_of_failures = 0; +bool Interval_nt_advanced::want_exceptions = true; std::ostream & operator<< (std::ostream & os, const Interval_nt_advanced & I)