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;