MorphoGraphX
Assert.hpp
Go to the documentation of this file.
1 //
2 // This file is part of MorphoGraphX - http://www.MorphoGraphX.org
3 // Copyright (C) 2012-2015 Richard S. Smith and collaborators.
4 //
5 // If you use MorphoGraphX in your work, please cite:
6 // http://dx.doi.org/10.7554/eLife.05864
7 //
8 // MorphoGraphX is free software, and is licensed under under the terms of the
9 // GNU General (GPL) Public License version 2.0, http://www.gnu.org/licenses.
10 //
11 #ifndef ASSERT_HPP
12 #define ASSERT_HPP
13 
22 #include <cassert>
23 
24 class QString;
25 
26 namespace mgx {
27 namespace util {
28 void __assert_fail(const QString& assertion, const char* file, unsigned int line, const char* function);
29 
30 #ifdef NDEBUG
31 # define mgx_assert(expr) static_cast<void>(0)
32 # define mgx_assert_msg(expr, msg) static_cast<void>(0)
33 #else
34 
42 # define mgx_assert(expr) \
43  ((expr) ? static_cast<void>(0) : mgx::util::__assert_fail(#expr, __FILE__, __LINE__, __PRETTY_FUNCTION__))
44 # define mgx_assert_msg(expr, msg) \
45  ((expr) ? static_cast<void>(0) : mgx::util::__assert_fail(msg, __FILE__, __LINE__, __PRETTY_FUNCTION__))
46 #endif
47 } // namespace util
48 } // namespace mgx
49 
50 #endif
This namespace contains all the API of MorphoGraphX.
Definition: Assert.hpp:26