30 # include <itpp/config.h> 32 # include <itpp/config_msvc.h> 45 static bool warnings_enabled =
true;
46 static bool file_line_info_enabled =
true;
47 static std::ostream *warn = &std::cerr;
50 void 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";
61 #ifdef ITPP_EXCEPTIONS 62 throw std::runtime_error(error.str());
68 void 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" 79 #ifdef ITPP_EXCEPTIONS 80 throw std::runtime_error(error.str());
93 if (warnings_enabled) {
94 if (file_line_info_enabled) {
95 (*warn) <<
"*** Warning in " << file <<
" on line " << line <<
":\n" 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_error_msg_style(error_msg_style style)
Set preferred style of assert, error and warning messages.
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.
error_msg_style
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_disable_warnings()
Disable warnings.
void it_info_f(std::string msg)
Helper function for the it_info and it_info_debug macros.
it_file & flush(it_file &f)
Flush operatorFlushes the data. Usage:
Error handling functions - header file.
void it_redirect_warnings(std::ostream *warn_stream)
Redirect warnings to the ostream warn_stream.
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.