Debug_utils.h
1 /* This file is part of the Gudhi Library - https://gudhi.inria.fr/ - which is released under MIT.
2  * See file LICENSE or go to https://gudhi.inria.fr/licensing/ for full license details.
3  * Author(s): David Salinas
4  *
5  * Copyright (C) 2014 Inria
6  *
7  * Modification(s):
8  * - YYYY/MM Author: Description of the modification
9  */
10 #ifndef DEBUG_UTILS_H_
11 #define DEBUG_UTILS_H_
12 
13 #include <iostream>
14 
15 #ifndef NDEBUG
16  // GUDHI_DEBUG is the Gudhi official flag for debug mode.
17  #define GUDHI_DEBUG
18 #endif
19 
20 // GUDHI_CHECK throw an exception if expression is false in debug mode, but does nothing in release mode
21 // Could assert in release mode, but cmake sets NDEBUG (for "NO DEBUG") in this mode, means assert does nothing.
22 #ifdef GUDHI_DEBUG
23  #define GUDHI_CHECK(expression, excpt) ((expression) ? (void) 0 : (throw excpt))
24  #define GUDHI_CHECK_code(CODE) CODE
25 #else
26  #define GUDHI_CHECK(expression, excpt) (void) 0
27  #define GUDHI_CHECK_code(CODE)
28 #endif
29 
30 #define PRINT(a) std::clog << #a << ": " << (a) << " (DISP)" << std::endl
31 
32 // #define DBG_VERBOSE
33 #ifdef DBG_VERBOSE
34  #define DBG(a) std::clog << "DBG: " << (a) << std::endl
35  #define DBGMSG(a, b) std::clog << "DBG: " << a << b << std::endl
36  #define DBGVALUE(a) std::clog << "DBG: " << #a << ": " << a << std::endl
37  #define DBGCONT(a) std::clog << "DBG: container " << #a << " -> "; for (auto x : a) std::clog << x << ","; std::clog << std::endl
38 #else
39  #define DBG(a) (void) 0
40  #define DBGMSG(a, b) (void) 0
41  #define DBGVALUE(a) (void) 0
42  #define DBGCONT(a) (void) 0
43 #endif
44 
45 #endif // DEBUG_UTILS_H_
GUDHIdev  Version 3.5.0  - C++ library for Topological Data Analysis (TDA) and Higher Dimensional Geometry Understanding.  - Copyright : MIT Generated on Tue Aug 16 2022 14:01:50 for GUDHIdev by Doxygen 1.9.1