Developer documentation
Version 3.0.3-105-gd3941f44
Debugging

functions and macros provided to ease debugging. More...

Macros

#define TRACE    std::cerr << MR::App::NAME << ": at " << __FILE__ << ": " << __LINE__ << "\n";
 Prints the current function, file and line number. More...
 
#define VAR(variable)    std::cerr << MR::App::NAME << " [" << __FILE__ << ": " << __LINE__ << "]: " << #variable << " = " << (variable) << "\n";
 Prints a variable name and its value, followed by the function, file and line number. More...
 
#define MAT(variable)
 Prints a matrix name and in the following line its formatted value. More...
 
#define VEC(variable)
 
#define PAUSE
 Stops execution and prints current function, file and line number. Remuses on user input (i.e. Return key). More...
 

Detailed Description

functions and macros provided to ease debugging.

Macro Definition Documentation

◆ MAT

#define MAT (   variable)
Value:
{ \
Eigen::IOFormat fmt(Eigen::FullPrecision, 0, ", ", ",\n ", "[", "]", "\nnp.array([", "])"); \
std::cerr << MR::App::NAME << " [" << __FILE__ << ": " << __LINE__ << "]: " << #variable << " = " << (variable.format(fmt)) << "\n"; \
}
std::string NAME
Definition: debug.h:25

Prints a matrix name and in the following line its formatted value.

Definition at line 45 of file debug.h.

◆ PAUSE

#define PAUSE
Value:
{ \
std::cerr << MR::App::NAME << " [" << __FILE__ << ": " << __LINE__ << "]: paused (press any key to resume)\n"; \
std::string __n__; std::getline (std::cin, __n__); \
}
std::istream & getline(std::istream &stream, std::string &string)
read a line from the stream
Definition: mrtrix.h:47

Stops execution and prints current function, file and line number. Remuses on user input (i.e. Return key).

Definition at line 59 of file debug.h.

◆ TRACE

#define TRACE    std::cerr << MR::App::NAME << ": at " << __FILE__ << ": " << __LINE__ << "\n";

Prints the current function, file and line number.

Definition at line 36 of file debug.h.

◆ VAR

#define VAR (   variable)     std::cerr << MR::App::NAME << " [" << __FILE__ << ": " << __LINE__ << "]: " << #variable << " = " << (variable) << "\n";

Prints a variable name and its value, followed by the function, file and line number.

Definition at line 41 of file debug.h.

◆ VEC

#define VEC (   variable)
Value:
{ \
std::cerr << MR::App::NAME << " [" << __FILE__ << ": " << __LINE__ << "]: " << #variable << " = "; \
for (ssize_t i=0; i<variable.size(); ++i){std::cerr << str(variable(i)) << " "; } \
std::cerr << std::endl; \
}
std::string str(const T &value, int precision=0)
Definition: mrtrix.h:247

Definition at line 50 of file debug.h.