itassert.h
Go to the documentation of this file.
#ifndef ITASSERT_H
#define ITASSERT_H
#include <sstream>
#include <string>
#include <itpp/itexports.h>
namespace itpp
{
ITPP_EXPORT void it_assert_f(std::string ass, std::string msg, std::string file, int line);
ITPP_EXPORT void it_error_f(std::string msg, std::string file, int line);
ITPP_EXPORT void it_info_f(std::string msg);
ITPP_EXPORT void it_warning_f(std::string msg, std::string file, int line);
ITPP_EXPORT void it_enable_exceptions(bool on);
ITPP_EXPORT void it_enable_warnings();
ITPP_EXPORT void it_disable_warnings();
ITPP_EXPORT void it_redirect_warnings(std::ostream *warn_stream);
enum error_msg_style { Full, Minimum };
ITPP_EXPORT void it_error_msg_style(error_msg_style style);
#define it_assert(t,s) \
if (!(t)) { \
std::ostringstream m_sout; \
m_sout << s; \
itpp::it_assert_f(#t,m_sout.str(),__FILE__,__LINE__); \
} else \
((void) 0)
#if defined(NDEBUG)
# define it_assert_debug(t,s) ((void) (t))
#else
# define it_assert_debug(t,s) it_assert(t,s)
#endif // if defined(NDEBUG)
#define it_assert0(t,s) it_assert_debug(t,s)
#define it_assert1(t,s) it_assert_debug(t,s)
#define it_error_if(t,s) \
if((t)) { \
std::ostringstream m_sout; \
m_sout << s; \
itpp::it_error_f(m_sout.str(),__FILE__,__LINE__); \
} else \
((void) 0)
#define it_error(s) \
if (true) { \
std::ostringstream m_sout; \
m_sout << s; \
itpp::it_error_f(m_sout.str(),__FILE__,__LINE__); \
} else \
((void) 0)
#define it_info(s) \
if (true) { \
std::ostringstream m_sout; \
m_sout << s << std::endl; \
itpp::it_info_f(m_sout.str()); \
} else \
((void) 0)
#define it_info_no_endl(s) \
if (true) { \
std::ostringstream m_sout; \
m_sout << s; \
itpp::it_info_f(m_sout.str()); \
} else \
((void) 0)
#if defined(NDEBUG)
# define it_info_debug(s) ((void) 0)
# define it_info_no_endl_debug(s) ((void) 0)
#else
# define it_info_debug(s) it_info(s)
# define it_info_no_endl_debug(s) it_info_no_endl(s)
#endif // if defined(NDEBUG)
#define it_warning(s) \
if (true) { \
std::ostringstream m_sout; \
m_sout << s; \
itpp::it_warning_f(m_sout.str(),__FILE__,__LINE__); \
} else \
((void) 0)
} // namespace itpp
#endif // #ifndef ITASSERT_H
itpp::Array
General array class.
Definition array.h:105
itpp::it_disable_warnings
void it_disable_warnings()
Disable warnings.
Definition itassert.cpp:109
itpp::error_msg_style
error_msg_style
Style of assert, error and warning messages.
Definition itassert.h:87
itpp::it_enable_warnings
void it_enable_warnings()
Enable warnings.
Definition itassert.cpp:104
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
itpp::it_error_msg_style
void it_error_msg_style(error_msg_style style)
Set preferred style of assert, error and warning messages.
Definition itassert.cpp:119
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
itpp::it_redirect_warnings
void it_redirect_warnings(std::ostream *warn_stream)
Redirect warnings to the ostream warn_stream.
Definition itassert.cpp:114
itpp::it_enable_exceptions
ITPP_EXPORT void it_enable_exceptions(bool on)
Enable/disable using exceptions for error handling.
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_info_f
void it_info_f(std::string msg)
Helper function for the it_info and it_info_debug macros.
Definition itassert.cpp:86
itpp
itpp namespace
Definition itmex.h:37

Generated on Mon Jun 10 2024 11:49:17 for IT++ by Doxygen 1.9.8