Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
CoMISo
Base
Commits
b377ef2d
Commit
b377ef2d
authored
Jun 20, 2017
by
Martin Marinov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove progress node ticks from DEB_warning(). Add enter() and exit() functions to Porgress:Node.
parent
c175be23
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
27 additions
and
10 deletions
+27
-10
Debug/DebOut.hh
Debug/DebOut.hh
+6
-5
Progress/ProgressNode.hh
Progress/ProgressNode.hh
+21
-5
No files found.
Debug/DebOut.hh
View file @
b377ef2d
...
...
@@ -21,9 +21,9 @@
#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_warning(LL, AA) {}
#define DEB_warning_if(CC, LL, AA) {}
#define DEB_error(AA) {}
#define DEB_error_if(CC, AA) {}
...
...
@@ -135,7 +135,8 @@ 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 PROGRESS_ACTIVE_TICK; \
#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);
...
...
@@ -155,9 +156,9 @@ std::string to_string(const T& _t)
{ 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)
{ PROGRESS_ACTIVE_TICK;
\
#define DEB_warning_if(CC, LL, AA) \
{ if (deb.pass(LL) && (CC)) { ::Base::OStringStream strm; strm << AA; \
::Debug::warning(strm.str, BASE_CODELINK); } }
}
::Debug::warning(strm.str, BASE_CODELINK); } }
#define DEB_error(AA) { ::Base::OStringStream strm; strm << AA; \
::Debug::error(strm.str, BASE_CODELINK); }
...
...
Progress/ProgressNode.hh
View file @
b377ef2d
...
...
@@ -22,10 +22,23 @@ public:
Node
(
const
char
*
const
_name
,
Node
*
_next
=
nullptr
,
Node
*
_chld
=
nullptr
)
:
name
(
_name
),
next_
(
_next
),
chld_
(
_chld
),
:
name
(
_name
),
next_
(
_next
),
chld_
(
_chld
),
prnt_
(
nullptr
),
tick_nmbr_
(
0
),
tick_nmbr_max_
(
1000000000
),
abrt_
(
false
)
{}
void
enter
(
Node
*
_prnt
)
{
prnt_
=
_prnt
;
tick_nmbr_
=
0
;
}
Node
*
exit
()
{
auto
prnt
=
prnt_
;
prnt_
=
nullptr
;
return
prnt
;
}
void
tick
(
const
char
*
const
_flnm
,
const
char
*
const
_fnct
)
{
++
tick_nmbr_
;
...
...
@@ -47,6 +60,7 @@ public:
protected:
Node
*
next_
;
//!< next node on the same level, last if nullptr
Node
*
chld_
;
//!< first child node, leaf if nullptr
Node
*
prnt_
;
//!< parent node, set temporarily
private:
TickNumber
tick_nmbr_
;
...
...
@@ -58,17 +72,19 @@ extern thread_local Node* actv_node; // active node
struct
ActiveScope
{
Node
*
prnt_node
;
ActiveScope
(
Node
*
_node
)
:
prnt_node
(
actv_node
)
{
if
(
_node
==
nullptr
)
return
;
_node
->
enter
(
actv_node
);
actv_node
=
_node
;
}
~
ActiveScope
()
{
actv_node
=
prnt_node
;
if
(
actv_node
==
nullptr
)
return
;
actv_node
=
actv_node
->
exit
();
}
};
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment