Debug_utils.h
1
/* This file is part of the Gudhi Library. The Gudhi library
2
* (Geometric Understanding in Higher Dimensions) is a generic C++
3
* library for computational topology.
4
*
5
* Author(s): David Salinas
6
*
7
* Copyright (C) 2014 Inria
8
*
9
* This program is free software: you can redistribute it and/or modify
10
* it under the terms of the GNU General Public License as published by
11
* the Free Software Foundation, either version 3 of the License, or
12
* (at your option) any later version.
13
*
14
* This program is distributed in the hope that it will be useful,
15
* but WITHOUT ANY WARRANTY; without even the implied warranty of
16
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17
* GNU General Public License for more details.
18
*
19
* You should have received a copy of the GNU General Public License
20
* along with this program. If not, see <http://www.gnu.org/licenses/>.
21
*/
22
#ifndef DEBUG_UTILS_H_
23
#define DEBUG_UTILS_H_
24
25
#include <iostream>
26
27
#ifndef NDEBUG
28
// GUDHI_DEBUG is the Gudhi official flag for debug mode.
29
#define GUDHI_DEBUG
30
#endif
31
32
// GUDHI_CHECK throw an exception if expression is false in debug mode, but does nothing in release mode
33
// Could assert in release mode, but cmake sets NDEBUG (for "NO DEBUG") in this mode, means assert does nothing.
34
#ifdef GUDHI_DEBUG
35
#define GUDHI_CHECK(expression, excpt) ((expression) ? (void) 0 : (throw excpt))
36
#define GUDHI_CHECK_code(CODE) CODE
37
#else
38
#define GUDHI_CHECK(expression, excpt) (void) 0
39
#define GUDHI_CHECK_code(CODE)
40
#endif
41
42
#define PRINT(a) std::cerr << #a << ": " << (a) << " (DISP)" << std::endl
43
44
// #define DBG_VERBOSE
45
#ifdef DBG_VERBOSE
46
#define DBG(a) std::cout << "DBG: " << (a) << std::endl
47
#define DBGMSG(a, b) std::cout << "DBG: " << a << b << std::endl
48
#define DBGVALUE(a) std::cout << "DBG: " << #a << ": " << a << std::endl
49
#define DBGCONT(a) std::cout << "DBG: container " << #a << " -> "; for (auto x : a) std::cout << x << ","; std::cout << std::endl
50
#else
51
#define DBG(a) (void) 0
52
#define DBGMSG(a, b) (void) 0
53
#define DBGVALUE(a) (void) 0
54
#define DBGCONT(a) (void) 0
55
#endif
56
57
#endif // DEBUG_UTILS_H_
GUDHI Version 2.2.0 - C++ library for Topological Data Analysis (TDA) and Higher Dimensional Geometry Understanding. - Copyright : GPL v3
Generated on Fri Jun 22 2018 08:12:19 for GUDHI by
Doxygen
1.8.13