29 #ifndef ITPP_SCI_ASSERT_H
30 #define ITPP_SCI_ASSERT_H
32 #define nITPP_EXCEPTIONS
33 #define SCI_EXCEPTIONS
38 #include "sci\_sci_exception.hpp"
72 void itpp_sci_assert_f(std::string ass, std::string msg, std::string file,
int line);
74 void itpp_sci_error_f(std::string msg, std::string file,
int line);
76 void itpp_sci_info_f(std::string msg);
78 void itpp_sci_warning_f(std::string msg, std::string file,
int line);
81 void itpp_sci_enable_exceptions(
bool on);
83 void itpp_sci_enable_warnings();
85 void itpp_sci_disable_warnings();
87 void itpp_sci_redirect_warnings(std::ostream *warn_stream);
90 enum itpp_sci_error_msg_style_t { msg_style_full, msg_style_minimum };
93 void itpp_sci_error_msg_style(itpp_sci_error_msg_style_t style);
97 #define itpp_sci_assert(t,s) \
99 std::ostringstream m_sout; \
101 itpp::itpp_sci_assert_f(#t,m_sout.str(),__FILE__,__LINE__); \
106 # define itpp_sci_assert_debug(t,s) ((void) (t))
109 # define itpp_sci_assert_debug(t,s) itpp_sci_assert(t,s)
111 #endif // if defined(NDEBUG)
114 #define itpp_sci_assert0(t,s) itpp_sci_assert_debug(t,s)
115 #define itpp_sci_assert1(t,s) itpp_sci_assert_debug(t,s)
120 #define itpp_sci_error_if(t,s) \
122 std::ostringstream m_sout; \
124 itpp::itpp_sci_error_f(m_sout.str(),__FILE__,__LINE__); \
129 #define itpp_sci_error(s) \
131 std::ostringstream m_sout; \
133 itpp::itpp_sci_error_f(m_sout.str(),__FILE__,__LINE__); \
139 #define itpp_sci_info(s) \
141 std::ostringstream m_sout; \
142 m_sout << s << std::endl; \
143 itpp::itpp_sci_info_f(m_sout.str()); \
148 #define itpp_sci_info_no_endl(s) \
150 std::ostringstream m_sout; \
152 itpp::itpp_sci_info_f(m_sout.str()); \
157 # define itpp_sci_info_debug(s) ((void) 0)
163 # define itpp_sci_info_no_endl_debug(s) ((void) 0)
165 # define itpp_sci_info_debug(s) itpp_sci_info(s)
171 # define itpp_sci_info_no_endl_debug(s) itpp_sci_info_no_endl(s)
172 #endif // if defined(NDEBUG)
176 #define itpp_sci_warning(s) \
178 std::ostringstream m_sout; \
180 itpp::itpp_sci_warning_f(m_sout.str(),__FILE__,__LINE__); \
184 class itpp_sci_assert_exception :
public std::exception
195 std::string get_msg()
200 itpp_sci_assert_exception(std::string msg,
int info) : msg_(msg), info_(info)
205 itpp_sci_assert_exception(std::string msg) : msg_(msg)
210 itpp_sci_assert_exception()
212 msg_ =
"Unknown Error";
224 #endif // #ifndef ITASSERT_H
Definition: _sci_assert.cpp:35