err_class Class Reference

#include <err_hnd.h>


Detailed Description

The error handler.

An error handler for use in O2scl which replaces the GSL error handler

Note that the string arguments to set() can refer to temporary storage, since they are copied when the function is called and an error is set.

Definition at line 135 of file err_hnd.h.


Public Member Functions

void set (const char *reason, const char *file, int line, int lerrno)
 Set an error.
void add (const char *reason, const char *file, int line, int lerrno)
 Add information to previous error.
void get (const char *&reason, const char *&file, int &line, int &lerrno)
 Get the last error.
int get_errno ()
 Return the last error number.
int get_line ()
 Return the line number of the last error.
const char * get_reason ()
 Return the reason for the last error.
const char * get_file ()
 Return the file name of the last error.
const char * get_str ()
 Return a string summarizing the last error.
void reset ()
 Remove last error information.
void set_mode (int m)
 Force a hard exit if an error occurs.

Static Public Member Functions

static void gsl_hnd (const char *reason, const char *file, int line, int lerrno)
 Set an error.

Data Fields

bool array_abort
 If true, call exit() when an array index error is set (default true).
size_t fname_size
 Number of characters from filename to print (default 35).

Protected Attributes

int a_errno
 The error number.
int a_line
 The line number.
int mode
 The mode of error handling.
char * a_file
 The filename.
char a_reason [rsize]
 The error explanation.
char fullstr [fsize]
 A full string with explanation and line and file info.

Static Protected Attributes

static err_classptr
 A pointer to the default error handler.
static const int rsize = 300
 The maximum size of error explanations.
static const int fsize = 400
 The maximum size of error explanations with the line and file info.

Member Function Documentation

static void gsl_hnd ( const char *  reason,
const char *  file,
int  line,
int  lerrno 
) [static]

Set an error.

This is separate from set(), since the gsl error handler needs to be a static function.


Field Documentation

If true, call exit() when an array index error is set (default true).

This is ignored if O2SCL_ARRAY_ABORT is not defined.

Definition at line 192 of file err_hnd.h.


The documentation for this class was generated from the following file:

Documentation generated with Doxygen and provided under the GNU Free Documentation License. See License Information for details.

Project hosting provided by SourceForge.net Logo, O2scl Sourceforge Project Page