Logo ROOT   6.12/07
Reference Guide
GSLError.h
Go to the documentation of this file.
1 // @(#)root/mathmore:$Id$
2 // Authors: L. Moneta, A. Zsenei 08/2005
3 
4  /**********************************************************************
5  * *
6  * Copyright (c) 2004 ROOT Foundation, CERN/PH-SFT *
7  * *
8  * This library is free software; you can redistribute it and/or *
9  * modify it under the terms of the GNU General Public License *
10  * as published by the Free Software Foundation; either version 2 *
11  * of the License, or (at your option) any later version. *
12  * *
13  * This library is distributed in the hope that it will be useful, *
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of *
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
16  * General Public License for more details. *
17  * *
18  * You should have received a copy of the GNU General Public License *
19  * along with this library (see file COPYING); if not, write *
20  * to the Free Software Foundation, Inc., 59 Temple Place, Suite *
21  * 330, Boston, MA 02111-1307 USA, or contact the author. *
22  * *
23  **********************************************************************/
24 
25 // Header file for class GSLError
26 
27 #ifndef ROOT_Math_GSLError
28 #define ROOT_Math_GSLError
29 
30 
31 #if defined(G__DICTIONARY)
32 
33 #include "gsl/gsl_errno.h"
34 
35 namespace ROOT {
36  namespace Math {
37 
38  /**
39  class to change GSL Error handler to use ROOT one.
40  It is used only when building the dictionary (G__DICTIONARY is defined)
41  and not in the stand-alone version of the library.
42  In that case the default GSL error handler is used
43  */
44 
45  class GSLError {
46 
47  public:
48 
49  GSLError() {
50  gsl_set_error_handler(&GSLError::Handler);
51  // set a new handler for GSL
52  }
53 
54  static void Handler(const char * reason, const char * file, int line, int gsl_errno) {
55 
56  Error("GSLError","Error %d in %s at %d : %s",gsl_errno,file,line,reason);
57 
58  }
59  };
60 
61  }
62 }
63 
64 // re-define the default error handler when loading the library
65 ROOT::Math::GSLError gGSLError;
66 
67 
68 #endif
69 
70 #endif /* ROOT_Math_GSLError */
Namespace for new ROOT classes and functions.
Definition: StringConv.hxx:21
TLine * line
Namespace for new Math classes and functions.
Definition: file.py:1
void Error(ErrorHandler_t func, int code, const char *va_(fmt),...)
Write error message and call a handler, if required.