Error and Warning Handling
Base Module

## Macros

#define | it_assert(t, s)
| Abort if `t` is not true. More...
#define | it_assert_debug(t, s) it_assert(t,s)
| Abort if `t` is not true and NDEBUG is not defined.
#define | it_assert0(t, s) it_assert_debug(t,s)
| Deprecated macro. Please use `it_assert_debug()` instead.
#define | it_assert1(t, s) it_assert_debug(t,s)
| Deprecated macro. Please use `it_assert_debug()` instead.
#define | it_error_if(t, s)
| Abort if `t` is true. More...
#define | it_error(s)
| Abort unconditionally. More...
#define | it_info(s)
| Print information message. More...
#define | it_info_no_endl(s)
| Print information message withot `std::endl` at the end. More...
#define | it_info_debug(s) it_info(s)
| Print information message if NDEBUG is not defined.
#define | it_info_no_endl_debug(s) it_info_no_endl(s)
| Print information message withot `std::endl` at the end if NDEBUG is not defined.
#define | it_warning(s)
| Display a warning message. More...

## Enumerations

enum | itpp::error_msg_style { Full, Minimum }
| Style of assert, error and warning messages.

## Functions

void | itpp::it_assert_f (std::string ass, std::string msg, std::string file, int line)
| Helper function for the `it_assert` and `it_assert_debug` macros.
void | itpp::it_error_f (std::string msg, std::string file, int line)
| Helper function for the `it_error` and `it_error_if` macros.
void | itpp::it_info_f (std::string msg)
| Helper function for the `it_info` and `it_info_debug` macros.
void | itpp::it_warning_f (std::string msg, std::string file, int line)
| Helper function for the `it_warning` macro.
ITPP_EXPORT void | itpp::it_enable_exceptions (bool on)
| Enable/disable using exceptions for error handling.
void | itpp::it_enable_warnings ()
| Enable warnings.
void | itpp::it_disable_warnings ()
| Disable warnings.
void | itpp::it_redirect_warnings (std::ostream *warn_stream)
| Redirect warnings to the ostream warn_stream.
void | itpp::it_error_msg_style (error_msg_style style)
| Set preferred style of assert, error and warning messages.

## Detailed Description

For the following macros, the argument `s` is a string that is displayed.

it_assert(t,s); // Abort if t is not true
it_assert_debug(t,s); // Abort if t is not true and NDEBUG is not defined
it_error_if(t,s); // Abort if t is true
it_error(s); // Abort
it_info(s); // Display a message
it_info_debug(s); // Display a message if NDEBUG is not defined
it_info_no_endl(s); // Display a message without appended "std::endl"
it_info_no_endl_debug(s); // Display a message without appended "std::endl" if NDEBUG is not defined
it_warning(s); // Display a warning

`it_assert()`, `it_error()`, `it_error_if()`, `it_info()`, `it_info_no_endl()` and `it_warning()` are always active, whereas `it_assert_debug()`, `it_info_debug()` and `it_info_no_endl_debug()` depends on the `NDEBUG` compile time definition. If `NDEBUG` is defined, then none of these macros is executed.

Note
  `it_assert0()` and `it_assert1()` macros are still defined for backward compatibility, but `it_assert_debug()` should be used instead of them.

## Macro Definition Documentation

## it_assert

#define it_assert | ( |  | t,
|  |  | s
| ) |  |

Value:
if (!(t)) { \
std::ostringstream m_sout; \
m_sout << s; \
itpp::it_assert_f(#t,m_sout.str(),__FILE__,__LINE__); \
} else \
((void) 0)

Abort if `t` is not true.

Definition at line 94 of file itassert.h.

## it_error_if

#define it_error_if | ( |  | t,
|  |  | s
| ) |  |

Value:
if((t)) { \
std::ostringstream m_sout; \
m_sout << s; \
itpp::it_error_f(m_sout.str(),__FILE__,__LINE__); \
} else \
((void) 0)

Abort if `t` is true.

Definition at line 117 of file itassert.h.

## it_error

#define it_error | ( |  | s | ) |

Value:
if (true) { \
std::ostringstream m_sout; \
m_sout << s; \
itpp::it_error_f(m_sout.str(),__FILE__,__LINE__); \
} else \
((void) 0)

Abort unconditionally.

Definition at line 126 of file itassert.h.

## it_info

#define it_info | ( |  | s | ) |

Value:
if (true) { \
std::ostringstream m_sout; \
m_sout << s << std::endl; \
itpp::it_info_f(m_sout.str()); \
} else \
((void) 0)

Print information message.

Definition at line 136 of file itassert.h.

## it_info_no_endl

#define it_info_no_endl | ( |  | s | ) |

Value:
if (true) { \
std::ostringstream m_sout; \
m_sout << s; \
itpp::it_info_f(m_sout.str()); \
} else \
((void) 0)

Print information message withot `std::endl` at the end.

Definition at line 145 of file itassert.h.

## it_warning

#define it_warning | ( |  | s | ) |

Value:
if (true) { \
std::ostringstream m_sout; \
m_sout << s; \
itpp::it_warning_f(m_sout.str(),__FILE__,__LINE__); \
} else \
((void) 0)

Display a warning message.

Definition at line 173 of file itassert.h.

it_info_no_endl_debug
#define it_info_no_endl_debug(s)
Print information message withot std::endl at the end if NDEBUG is not defined.
Definition: itassert.h:168
it_warning
#define it_warning(s)
Display a warning message.
Definition: itassert.h:173
itpp::it_error_f
void it_error_f(std::string msg, std::string file, int line)
Helper function for the it_error and it_error_if macros.
Definition: itassert.cpp:68
it_error_if
#define it_error_if(t, s)
Abort if t is true.
Definition: itassert.h:117
itpp::it_info_f
void it_info_f(std::string msg)
Helper function for the it_info and it_info_debug macros.
Definition: itassert.cpp:86
it_info_no_endl
#define it_info_no_endl(s)
Print information message withot std::endl at the end.
Definition: itassert.h:145
it_assert_debug
#define it_assert_debug(t, s)
Abort if t is not true and NDEBUG is not defined.
Definition: itassert.h:107
it_error
#define it_error(s)
Abort unconditionally.
Definition: itassert.h:126
itpp::it_assert_f
void it_assert_f(std::string ass, std::string msg, std::string file, int line)
Helper function for the it_assert and it_assert_debug macros.
Definition: itassert.cpp:50
itpp::it_warning_f
void it_warning_f(std::string msg, std::string file, int line)
Helper function for the it_warning macro.
Definition: itassert.cpp:91
it_info
#define it_info(s)
Print information message.
Definition: itassert.h:136
it_info_debug
#define it_info_debug(s)
Print information message if NDEBUG is not defined.
Definition: itassert.h:163
it_assert
#define it_assert(t, s)
Abort if t is not true.
Definition: itassert.h:94

Generated on Mon Mar 23 2020 06:18:03 for IT++ by Doxygen 1.8.17