Split <CGAL/assertions.h> in 2 files, by moving the assertion behaviour

changing functions to a separate header, not included by default
(<CGAL/assertions_behaviour.h>).  The motivation is to hide the enum
values with risky names (ABORT, EXIT, CONTINUE) to a header file which
is most probably not used by any user (or very few).
(breaks backward compatibility for an expected very few, for the sake
of erasing random surprises for "many" ?)
This commit is contained in:
Sylvain Pion 2008-11-21 16:42:02 +00:00
parent 51ee5848db
commit 8eab7e07dd
10 changed files with 75 additions and 31 deletions

View File

@ -1,3 +1,5 @@
#include <CGAL/assertions_behaviour.h>
bool test( string off_file )
{
bool rContinue = true ;

View File

@ -16,7 +16,9 @@ The following functionality has been added or changed:
helping users discover if they rely on code that may be removed in
subsequent releases.
- It is not possible anymore to set the CONTINUE mode for assertion failures.
- Assertion behaviour:
It is not possible anymore to set the CONTINUE mode for assertion failures.
Functions that allow to change the assertion behaviour are now declared in <CGAL/assertions_behaviour.h>.
2- Installation

View File

@ -95,7 +95,7 @@ violated, an exception is thrown, and if nothing is done to catch it,
the program will abort.
This behavior can be changed by means of the following function.
\ccInclude{CGAL/assertions.h}
\ccInclude{CGAL/assertions_behaviour.h}
\ccGlueBegin
\ccGlobalFunction{Failure_behaviour

View File

@ -1508,6 +1508,7 @@ const QString MyWindow::my_filters =
#include <CGAL/assertions.h>
#include <CGAL/assertions_behaviour.h>
#include <exception>
CGAL::Failure_function my_previous_failure_function;

View File

@ -26,14 +26,10 @@
#ifndef CGAL_ASSERTIONS_H
#define CGAL_ASSERTIONS_H
// #include <CGAL/assertions_behaviour> // for backward compatibility
CGAL_BEGIN_NAMESPACE
// types
// =====
enum Failure_behaviour { ABORT, EXIT, EXIT_WITH_SUCCESS, CONTINUE,
THROW_EXCEPTION };
// function declarations
// =====================
// failure functions
@ -278,29 +274,6 @@ inline bool possibly(Uncertain<bool> c);
#define CGAL_error_msg(MSG) ::CGAL::assertion_fail( "", __FILE__, __LINE__, MSG )
#define CGAL_error() ::CGAL::assertion_fail( "", __FILE__, __LINE__ )
// failure handler declarations
// ==========================
// failure handler
// ---------------
typedef
void
(*Failure_function)(
const char*, const char*, const char*, int, const char*);
Failure_function
set_error_handler( Failure_function handler);
Failure_function
set_warning_handler( Failure_function handler);
// failure behaviour handler
// -------------------------
Failure_behaviour
set_error_behaviour(Failure_behaviour eb);
Failure_behaviour
set_warning_behaviour(Failure_behaviour eb);
CGAL_END_NAMESPACE
// This comes last as it is dependant on the macros to be defined.

View File

@ -0,0 +1,59 @@
// Copyright (c) 1999 Utrecht University (The Netherlands),
// ETH Zurich (Switzerland), Freie Universitaet Berlin (Germany),
// INRIA Sophia-Antipolis (France), Martin-Luther-University Halle-Wittenberg
// (Germany), Max-Planck-Institute Saarbruecken (Germany), RISC Linz (Austria),
// and Tel-Aviv University (Israel). 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$
// $Id$
//
//
// Author(s) : Geert-Jan Giezeman and Sven Schoenherr
#include <CGAL/config.h>
#ifndef CGAL_ASSERTIONS_BEHAVIOUR_H
#define CGAL_ASSERTIONS_BEHAVIOUR_H
CGAL_BEGIN_NAMESPACE
enum Failure_behaviour { ABORT, EXIT, EXIT_WITH_SUCCESS, CONTINUE,
THROW_EXCEPTION };
// failure handler declarations
// ==========================
// failure handler
// ---------------
typedef
void
(*Failure_function)(
const char*, const char*, const char*, int, const char*);
Failure_function
set_error_handler( Failure_function handler);
Failure_function
set_warning_handler( Failure_function handler);
// failure behaviour handler
// -------------------------
Failure_behaviour
set_error_behaviour(Failure_behaviour eb);
Failure_behaviour
set_warning_behaviour(Failure_behaviour eb);
CGAL_END_NAMESPACE
#endif // CGAL_ASSERTIONS_BEHAVIOUR_H

View File

@ -23,6 +23,7 @@
#include <CGAL/config.h>
#include <CGAL/assertions.h>
#include <CGAL/assertions_behaviour.h>
#include <CGAL/exceptions.h>
#include <cstdlib>

View File

@ -53,6 +53,8 @@
#include <CGAL/IO/Qt_help_window.h>
#include <CGAL/IO/pixmaps/demoicon.xpm>
#include <CGAL/assertions_behaviour.h>
#include "ss_types.h"
#include "straight_skeleton_2_toolbar.h"
#include "straight_skeleton_2_toolbar_layers.h"

View File

@ -28,6 +28,8 @@
#include<boost/tokenizer.hpp>
#include <CGAL/assertions_behaviour.h>
bool sTestInner = true ;
bool sTestOuter = true ;
bool sTestOffsets = true ;

View File

@ -49,6 +49,8 @@
#include <CGAL/IO/Polyhedron_iostream.h>
#include <CGAL/Polyhedron_items_with_id_3.h>
#include <CGAL/assertions_behaviour.h>
using namespace std ;
using namespace boost ;
using namespace CGAL ;