IT++ Logo
Macros | Enumerations | Functions
Error and Warning Handling

Macros

#define it_assert(t, s)
 Abort if t is not true.
 
#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.
 
#define it_error(s)
 Abort unconditionally.
 
#define it_info(s)
 Print information message.
 
#define it_info_no_endl(s)
 Print information message withot std::endl at the end.
 
#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.
 

Enumerations

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

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
#define it_error_if(t, s)
Abort if t is true.
Definition: itassert.h:117
#define it_error(s)
Abort unconditionally.
Definition: itassert.h:126
#define it_warning(s)
Display a warning message.
Definition: itassert.h:173
#define it_info(s)
Print information message.
Definition: itassert.h:136
#define it_info_debug(s)
Print information message if NDEBUG is not defined.
Definition: itassert.h:163
#define it_info_no_endl(s)
Print information message withot std::endl at the end.
Definition: itassert.h:145
#define it_assert_debug(t, s)
Abort if t is not true and NDEBUG is not defined.
Definition: itassert.h:107
#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
#define it_assert(t, s)
Abort if t is not true.
Definition: itassert.h:94

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,
 
)
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_assert_debug

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

Abort if t is not true and NDEBUG is not defined.

Definition at line 107 of file itassert.h.

◆ it_assert0

#define it_assert0 (   t,
 
)    it_assert_debug(t,s)

Deprecated macro. Please use it_assert_debug() instead.

Definition at line 111 of file itassert.h.

◆ it_assert1

#define it_assert1 (   t,
 
)    it_assert_debug(t,s)

Deprecated macro. Please use it_assert_debug() instead.

Definition at line 113 of file itassert.h.

◆ it_error_if

#define it_error_if (   t,
 
)
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_info_debug

#define it_info_debug (   s)    it_info(s)

Print information message if NDEBUG is not defined.

Definition at line 163 of file itassert.h.

◆ it_info_no_endl_debug

#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.

Definition at line 168 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.

Enumeration Type Documentation

◆ error_msg_style

Style of assert, error and warning messages.

Definition at line 87 of file itassert.h.

Function Documentation

◆ it_assert_f()

ITPP_EXPORT 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.

Definition at line 50 of file itassert.cpp.

◆ it_error_f()

ITPP_EXPORT void itpp::it_error_f ( std::string  msg,
std::string  file,
int  line 
)

Helper function for the it_error and it_error_if macros.

Definition at line 68 of file itassert.cpp.

◆ it_info_f()

ITPP_EXPORT void itpp::it_info_f ( std::string  msg)

Helper function for the it_info and it_info_debug macros.

Definition at line 86 of file itassert.cpp.

◆ it_warning_f()

ITPP_EXPORT void itpp::it_warning_f ( std::string  msg,
std::string  file,
int  line 
)

Helper function for the it_warning macro.

Definition at line 91 of file itassert.cpp.

◆ it_enable_warnings()

ITPP_EXPORT void itpp::it_enable_warnings ( )

Enable warnings.

Definition at line 104 of file itassert.cpp.

◆ it_disable_warnings()

ITPP_EXPORT void itpp::it_disable_warnings ( )

Disable warnings.

Definition at line 109 of file itassert.cpp.

◆ it_redirect_warnings()

ITPP_EXPORT void itpp::it_redirect_warnings ( std::ostream *  warn_stream)

Redirect warnings to the ostream warn_stream.

Definition at line 114 of file itassert.cpp.

◆ it_error_msg_style()

ITPP_EXPORT void itpp::it_error_msg_style ( error_msg_style  style)

Set preferred style of assert, error and warning messages.

Definition at line 119 of file itassert.cpp.

SourceForge Logo

Generated on Tue Jan 24 2023 00:00:00 for IT++ by Doxygen 1.9.6