Go to the documentation of this file.
30# include <itpp/config.h>
32# include <itpp/config_msvc.h>
45static bool warnings_enabled =
true;
46static bool file_line_info_enabled =
true;
47static std::ostream *warn = &std::cerr;
50void it_assert_f(std::string ass, std::string msg, std::string file,
int line)
52 std::ostringstream error;
53 if (file_line_info_enabled) {
54 error <<
"*** Assertion failed in " << file <<
" on line " << line
55 <<
":\n" << msg <<
" (" << ass <<
")\n";
58 error << msg <<
" (" << ass <<
")\n";
60 std::cerr << error.str() << std::flush;
62 throw std::runtime_error(error.str());
68void it_error_f(std::string msg, std::string file,
int line)
70 std::ostringstream error;
71 if (file_line_info_enabled) {
72 error <<
"*** Error in " << file <<
" on line " << line <<
":\n"
78 std::cerr << error.str() << std::flush;
80 throw std::runtime_error(error.str());
88 std::cerr << msg << std::flush;
93 if (warnings_enabled) {
94 if (file_line_info_enabled) {
95 (*warn) <<
"*** Warning in " << file <<
" on line " << line <<
":\n"
96 << msg << std::endl << std::flush;
99 (*warn) << msg << std::endl << std::flush;
106 warnings_enabled =
true;
111 warnings_enabled =
false;
123 file_line_info_enabled =
true;
126 file_line_info_enabled =
false;
129 file_line_info_enabled =
true;
void it_disable_warnings()
Disable warnings.
error_msg_style
Style of assert, error and warning messages.
void it_enable_warnings()
Enable warnings.
void it_warning_f(std::string msg, std::string file, int line)
Helper function for the it_warning macro.
void it_error_msg_style(error_msg_style style)
Set preferred style of assert, error and warning messages.
void it_error_f(std::string msg, std::string file, int line)
Helper function for the it_error and it_error_if macros.
void it_redirect_warnings(std::ostream *warn_stream)
Redirect warnings to the ostream warn_stream.
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.
void it_info_f(std::string msg)
Helper function for the it_info and it_info_debug macros.
Error handling functions - header file.
Generated on Tue Dec 10 2024 04:49:37 for IT++ by Doxygen 1.12.0