15#ifndef ERS_ASSERTION_H
16#define ERS_ASSERTION_H
33 "Assertion (" << condition
34 <<
") failed because " << reason,
35 ((
const char *)condition )
36 ((
const char *)reason ) )
39#define ERS_INTERNAL_ABORT(m) __assert_func (__FILE__, __LINE__, __ASSERT_FUNC, m)
41#define ERS_INTERNAL_ABORT(_) ::abort()
46#define ERS_ASSERT_MSG( expression, message ) { \
49 std::ostringstream ers_report_impl_out_buffer; \
50 ers_report_impl_out_buffer << BOOST_PP_IF( ERS_IS_EMPTY( message ), "of unknown reason", message ); \
51 std::string reason = ers_report_impl_out_buffer.str(); \
52 ers::Assertion __issue__( ERS_HERE, #expression, reason.c_str() ); \
53 ers::StreamManager::instance().report_issue( ers::Fatal, __issue__ ); \
54 ERS_INTERNAL_ABORT(#expression); \
62#define ERS_ASSERT( expression ) ERS_ASSERT_MSG( expression, "of bad internal state" )
69#define ERS_PRECONDITION( expression ) ERS_ASSERT_MSG( expression, "of bad external parameter" )
76#define ERS_RANGE_CHECK( min, val, max ) \
77 ERS_ASSERT_MSG( (min) <= (val) && (val) <= (max), \
78 val << " is not in [" << min << "," << max << "] range" )
85#define ERS_STRICT_RANGE_CHECK( min, val, max ) \
86 ERS_ASSERT_MSG( (min) < (val) && (val) < (max), \
87 val << " is not in (" << min << "," << max << ") range" )
#define ERS_DECLARE_ISSUE(namespace_name, class_name, message, attributes)