Object-oriented Scientific Computing Library: Version 0.910
Data Structures | Defines | Enumerations | Functions | Variables
err_hnd.h File Reference

File for definitions for err_hnd_type and err_hnd_gsl. More...

#include <iostream>
#include <string>
#include <gsl/gsl_errno.h>

Go to the source code of this file.


Detailed Description

See also exception.h .

Definition in file err_hnd.h.

Data Structures

class  err_hnd_type
 Class defining an error handler [abstract base]. More...
class  err_hnd_gsl
 The error handler. More...

Defines

#define O2SCL_ERR(d, n)   o2scl::set_err_fn(d,__FILE__,__LINE__,n);
 Set an error with message d and code n.
#define O2SCL_CONV(d, n, b)   {if (b) o2scl::set_err_fn(d,__FILE__,__LINE__,n);}
 Set a "convergence" error.
#define O2SCL_ERR2(d, d2, n)
 Set an error, two-string version.
#define O2SCL_CONV2(d, d2, n, b)
 Set a "convergence" error, two-string version.
#define O2SCL_ERR_RET(d, n)   do { o2scl::set_err_fn(d,__FILE__,__LINE__,n); return n; } while (0)
 Set an error and return the error value.
#define O2SCL_CONV_RET(d, n, b)
 Set a "convergence" error and return the error value.
#define O2SCL_ERR2_RET(d, d2, n)
 Set an error and return the error value, two-string version.
#define O2SCL_CONV2_RET(d, d2, n, b)
 Set an error and return the error value, two-string version.
#define O2SCL_ASSERT(ev)
 A version of assert, i.e. exit if the error value is non-zero and do nothing otherwise.
#define O2SCL_BOOL_ASSERT(ev, str)
 A version of assert for bool types. Exit if the argument is false.

Enumerations

enum  {
  gsl_success = 0, gsl_failure = -1, gsl_continue = -2, gsl_edom = 1,
  gsl_erange = 2, gsl_efault = 3, gsl_einval = 4, gsl_efailed = 5,
  gsl_efactor = 6, gsl_esanity = 7, gsl_enomem = 8, gsl_ebadfunc = 9,
  gsl_erunaway = 10, gsl_emaxiter = 11, gsl_ezerodiv = 12, gsl_ebadtol = 13,
  gsl_etol = 14, gsl_eundrflw = 15, gsl_eovrflw = 16, gsl_eloss = 17,
  gsl_eround = 18, gsl_ebadlen = 19, gsl_enotsqr = 20, gsl_esing = 21,
  gsl_ediverge = 22, gsl_eunsup = 23, gsl_eunimpl = 24, gsl_ecache = 25,
  gsl_etable = 26, gsl_enoprog = 27, gsl_enoprogj = 28, gsl_etolf = 29,
  gsl_etolx = 30, gsl_etolg = 31, gsl_eof = 32, gsl_enotfound = 33,
  gsl_ememtype = 34, gsl_efilenotfound = 35, gsl_eindex = 36, gsl_outsidecons = 37
}
 The integer error definitions. More...

Functions

void set_err_fn (const char *desc, const char *file, int line, int errnum)
 Set an error.
void error_update (int &ret, int err)
 Update an error value err with the value in ret.

Variables

err_hnd_typeerr_hnd
 The global error handler pointer.
err_hnd_gsl alt_err_hnd
 An alternate GSL-like error handler.

Define Documentation

#define O2SCL_ERR2 (   d,
  d2,
 
)
Value:
o2scl::set_err_fn((std::string(d)+d2).c_str(), \
                                             __FILE__,__LINE__,n);

Definition at line 306 of file err_hnd.h.

#define O2SCL_CONV2 (   d,
  d2,
  n,
 
)
Value:
{if (b)                                 \
      o2scl::set_err_fn((std::string(d)+d2).c_str(),                    \
                        __FILE__,__LINE__,n);}

Definition at line 311 of file err_hnd.h.

#define O2SCL_CONV_RET (   d,
  n,
 
)
Value:
do { if (!b) { return 0; } else {                                       \
      o2scl::set_err_fn(d,__FILE__,__LINE__,n); return n; } } while (0)

Definition at line 322 of file err_hnd.h.

#define O2SCL_ERR2_RET (   d,
  d2,
 
)
Value:
do { o2scl::set_err_fn((std::string(d)+d2).c_str(),                     \
                         __FILE__,__LINE__,n); return n; } while (0)

Definition at line 328 of file err_hnd.h.

#define O2SCL_CONV2_RET (   d,
  d2,
  n,
 
)
Value:
do { if (!b) {return 0; } else {                                        \
      o2scl::set_err_fn((std::string(d)+d2).c_str(),                    \
                        __FILE__,__LINE__,n); return n; } } while (0)

Definition at line 334 of file err_hnd.h.

#define O2SCL_ASSERT (   ev)
Value:
do { if (ev!=0) { std::cout << "O2scl: Macro err_assert() causing exit" \
                              << " from error " << ev << " at "         \
                              << __LINE__ << " in file:\n "             \
                              << __FILE__ << std::endl;                 \
      std::cout << "Error handler string:\n " << err_hnd->get_str()     \
                << std::endl; exit(ev); } } while (0)
Idea for Future:
Make this consistent with assert() using NDEBUG?

Definition at line 359 of file err_hnd.h.

#define O2SCL_BOOL_ASSERT (   ev,
  str 
)
Value:
do { if (ev==false) {                                                   \
      std::cout << "O2scl: Macro bool_assert() causing exit at line "   \
                << __LINE__ << " in file:\n "                           \
                << __FILE__ << std::endl;                               \
      std::cout << "Given string: " << str                              \
                << std::endl; exit(-1); } } while (0)

Definition at line 370 of file err_hnd.h.


Enumeration Type Documentation

anonymous enum

The errors associated with the integers between -2 and 32 are from GSL, the rest are specific to O2scl .

Enumerator:
gsl_success 

Success (GSL)

gsl_failure 

Failure (GSL)

gsl_continue 

iteration has not converged (GSL)

gsl_edom 

input domain error, e.g sqrt(-1) (GSL)

gsl_erange 

output range error, e.g. exp(1e100) (GSL)

gsl_efault 

invalid pointer (GSL)

gsl_einval 

invalid argument supplied by user (GSL)

gsl_efailed 

generic failure (GSL)

gsl_efactor 

factorization failed (GSL)

gsl_esanity 

sanity check failed - shouldn't happen (GSL)

gsl_enomem 

malloc failed (GSL)

gsl_ebadfunc 

problem with user-supplied function (GSL)

gsl_erunaway 

iterative process is out of control (GSL)

gsl_emaxiter 

exceeded max number of iterations (GSL)

gsl_ezerodiv 

tried to divide by zero (GSL)

gsl_ebadtol 

user specified an invalid tolerance (GSL)

gsl_etol 

failed to reach the specified tolerance (GSL)

gsl_eundrflw 

underflow (GSL)

gsl_eovrflw 

overflow (GSL)

gsl_eloss 

loss of accuracy (GSL)

gsl_eround 

failed because of roundoff error (GSL)

gsl_ebadlen 

matrix, vector lengths are not conformant (GSL)

gsl_enotsqr 

matrix not square (GSL)

gsl_esing 

apparent singularity detected (GSL)

gsl_ediverge 

integral or series is divergent (GSL)

gsl_eunsup 

requested feature is not supported by the hardware (GSL)

gsl_eunimpl 

requested feature not (yet) implemented (GSL)

gsl_ecache 

cache limit exceeded (GSL)

gsl_etable  table limit exceeded (GSL)

gsl_enoprog 

iteration is not making progress toward solution (GSL)

gsl_enoprogj  jacobian evaluations are not improving the solution (GSL)

gsl_etolf 

cannot reach the specified tolerance in f (GSL)

gsl_etolx 

cannot reach the specified tolerance in x (GSL)

gsl_etolg 

cannot reach the specified tolerance in gradient (GSL)

gsl_eof 

end of file (GSL)

gsl_enotfound 

Generic "not found" result.

gsl_ememtype 

Incorrect type for memory object.

gsl_efilenotfound 

File not found.

gsl_eindex 

Invalid index for array or matrix.

gsl_outsidecons 

Outside constraint region.

Definition at line 45 of file err_hnd.h.


Function Documentation

void error_update ( int &  ret,
int  err 
) [inline]

If ret is zero, this sets ret to the value err, and if ret is nonzero this function does nothing.

Definition at line 352 of file err_hnd.h.

 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines

Documentation generated with Doxygen. Provided under the GNU Free Documentation License (see License Information).

Get Object-oriented Scientific Computing
Lib at SourceForge.net. Fast, secure and Free Open Source software
downloads.