Skip to content
Snippets Groups Projects
Commit badb563a authored by Martin Marinov's avatar Martin Marinov
Browse files

Hook the progress active node tick to some of DEB_ macros. Add the PROGRESS_ABORTED error.

parent 89d448ea
No related branches found
No related tags found
No related merge requests found
......@@ -3,21 +3,26 @@
#ifndef BASE_DEBOUT_HH_INCLUDED
#define BASE_DEBOUT_HH_INCLUDED
#ifdef PROGRESS_ON
#include "Base/Progress/ProgressNode.hh"
#else//PROGRESS_ON
#define PROGRESS_ACTIVE_TICK
#endif//PROGRESS_ON
// DEB_ON is defined, or not, in CMakeLists.txt for primary project
#ifndef DEB_ON
#define DEB_module(SS)
#define DEB_enter_func
#define DEB_enter_func PROGRESS_ACTIVE_TICK;
#define DEB_only(CC)
#define DEB_exec(LL, AA) {}
#define DEB_exec_if(CC, LL, AA) {}
#define DEB_out(LL, AA) {}
#define DEB_out_if(CC, LL, AA) {}
#define DEB_line(LL, AA) {}
#define DEB_line_if(CC, LL, AA) {}
#define DEB_warning(LL, AA) {}
#define DEB_warning_if(CC, LL, AA) {}
#define DEB_mesh_if(CC, LL, FF, MM) {}
#define DEB_exec(LL, AA) { PROGRESS_ACTIVE_TICK; }
#define DEB_exec_if(CC, LL, AA) { PROGRESS_ACTIVE_TICK; }
#define DEB_out(LL, AA) { PROGRESS_ACTIVE_TICK; }
#define DEB_out_if(CC, LL, AA) { PROGRESS_ACTIVE_TICK; }
#define DEB_line(LL, AA) { PROGRESS_ACTIVE_TICK; }
#define DEB_line_if(CC, LL, AA) { PROGRESS_ACTIVE_TICK; }
#define DEB_warning(LL, AA) { PROGRESS_ACTIVE_TICK; }
#define DEB_warning_if(CC, LL, AA) { PROGRESS_ACTIVE_TICK; }
#define DEB_error(AA) {}
#define DEB_error_if(CC, AA) {}
......@@ -130,27 +135,29 @@ std::string to_string(const T& _t)
#define DEB_module(MODULE)
//TODO: This should use an atomic thread-safe static int(s)
#define DEB_enter_func static int deb_nmbr = 0; \
#define DEB_enter_func PROGRESS_ACTIVE_TICK; \
static int deb_nmbr = 0; \
static int deb_lvl = Debug::INVALID_LEVEL; \
::Debug::Enter deb(__FILE__, __FUNCTION__, deb_nmbr, deb_lvl);
#define DEB_only(CC) CC
#define DEB_exec(LL, AA) DEB_exec_if(true, LL, AA)
#define DEB_exec_if(CC, LL, AA) { if (deb.pass(LL) && (CC)) { AA; } }
#define DEB_exec_if(CC, LL, AA) { PROGRESS_ACTIVE_TICK; \
{ if (deb.pass(LL) && (CC)) { AA; } } }
#define DEB_out(LL, AA) DEB_out_if(true, LL, AA)
#define DEB_out_if(CC, LL, AA) { if (deb.pass(LL) && (CC)) \
{ deb.stream() << AA << ::Base::Command::END; } }
#define DEB_out_if(CC, LL, AA) { PROGRESS_ACTIVE_TICK; \
{ if (deb.pass(LL) && (CC)) { deb.stream() << AA << ::Base::Command::END; } } }
#define DEB_line(LL, AA) DEB_line_if(true, LL, AA)
#define DEB_line_if(CC, LL, AA) { if (deb.pass(LL) && (CC)) \
{ deb.stream() << AA << ::Base::LF; } }
#define DEB_line_if(CC, LL, AA) { PROGRESS_ACTIVE_TICK; \
{ if (deb.pass(LL) && (CC)) { deb.stream() << AA << ::Base::LF; } } }
#define DEB_warning(LL, AA) DEB_warning_if(true, LL, AA)
#define DEB_warning_if(CC, LL, AA) { if (deb.pass(LL) && (CC)) \
{ ::Base::OStringStream strm; strm << AA; \
::Debug::warning(strm.str, BASE_CODELINK); } }
#define DEB_warning_if(CC, LL, AA) { PROGRESS_ACTIVE_TICK; \
{ if (deb.pass(LL) && (CC)) { ::Base::OStringStream strm; strm << AA; \
::Debug::warning(strm.str, BASE_CODELINK); } } }
#define DEB_error(AA) { ::Base::OStringStream strm; strm << AA; \
::Debug::error(strm.str, BASE_CODELINK); }
......@@ -164,5 +171,4 @@ std::string to_string(const T& _t)
#define DEB_os_str(AA) Debug::to_string(AA)
#endif // DEB_ON
#endif // BASE_DEBOUT_HH_INCLUDED
......@@ -9,3 +9,4 @@
// and it is not an error code.
DEFINE_ERROR(SUCCESS, "Success")
DEFINE_ERROR(TODO, "TODO: Undefined error message")
DEFINE_ERROR(PROGRESS_ABORTED, "Progress cancelled")
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment