Developer documentation
Version 3.0.3-105-gd3941f44
debug.h
Go to the documentation of this file.
1/* Copyright (c) 2008-2022 the MRtrix3 contributors.
2 *
3 * This Source Code Form is subject to the terms of the Mozilla Public
4 * License, v. 2.0. If a copy of the MPL was not distributed with this
5 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
6 *
7 * Covered Software is provided under this License on an "as is"
8 * basis, without warranty of any kind, either expressed, implied, or
9 * statutory, including, without limitation, warranties that the
10 * Covered Software is free of defects, merchantable, fit for a
11 * particular purpose or non-infringing.
12 * See the Mozilla Public License v. 2.0 for more details.
13 *
14 * For more details, see http://www.mrtrix.org/.
15 */
16
17#ifndef __debug_h__
18#define __debug_h__
19
20#include <iostream>
21#include <cstring>
22
23namespace MR {
24 namespace App {
25 extern std::string NAME;
26 }
27}
28
36#define TRACE \
37 std::cerr << MR::App::NAME << ": at " << __FILE__ << ": " << __LINE__ << "\n";
38
39
41#define VAR(variable) \
42 std::cerr << MR::App::NAME << " [" << __FILE__ << ": " << __LINE__ << "]: " << #variable << " = " << (variable) << "\n";
43
45#define MAT(variable) { \
46 Eigen::IOFormat fmt(Eigen::FullPrecision, 0, ", ", ",\n ", "[", "]", "\nnp.array([", "])"); \
47 std::cerr << MR::App::NAME << " [" << __FILE__ << ": " << __LINE__ << "]: " << #variable << " = " << (variable.format(fmt)) << "\n"; \
48}
49
50#define VEC(variable) { \
51 std::cerr << MR::App::NAME << " [" << __FILE__ << ": " << __LINE__ << "]: " << #variable << " = "; \
52 for (ssize_t i=0; i<variable.size(); ++i){std::cerr << str(variable(i)) << " "; } \
53 std::cerr << std::endl; \
54}
55
56
59#define PAUSE { \
60 std::cerr << MR::App::NAME << " [" << __FILE__ << ": " << __LINE__ << "]: paused (press any key to resume)\n"; \
61 std::string __n__; std::getline (std::cin, __n__); \
62}
63
66#endif
67
std::string NAME
Definition: debug.h:25
Definition: base.h:24