73 #ifdef CISST_CMN_ASSERT_DISABLED
74 #define CMN_ASSERT(expr)
75 #else // CISST_CMN_ASSERT_DISABLED
77 #ifdef CISST_CMN_ASSERT_THROWS_EXCEPTION
79 #define CMN_ASSERT(expr) \
81 std::stringstream messageBuffer; \
82 messageBuffer << __FILE__ << ": Assertion '" << #expr \
83 << "' failed in: " << CMN_PRETTY_FUNCTION \
84 << ", line #" << __LINE__; \
85 cmnThrow(std::logic_error(messageBuffer.str())); \
88 #else // CISST_CMN_ASSERT_THROWS_EXCEPTION
90 #define CMN_ASSERT(expr) \
92 std::stringstream messageBuffer; \
93 messageBuffer << __FILE__ << ": Assertion '" << #expr \
94 << "' failed in: " << CMN_PRETTY_FUNCTION \
95 << ", line #" << __LINE__; \
96 std::cerr << messageBuffer.str() << std::endl; \
97 CMN_LOG_INIT_ERROR << messageBuffer.str() << std::endl; \
101 #endif // CISST_CMN_ASSERT_THROWS_EXCEPTION
103 #endif // CISST_CMN_ASSERT_DISABLED
106 #endif // _cmnAssert_h
Portability across compilers and operating systems tools.
Declaration of cmnLogger amd macros for human readable logging.
Declaration of the template function cmnThrow.