Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
OpenDAS
dlib
Commits
64afd2ec
Commit
64afd2ec
authored
Mar 17, 2013
by
Davis King
Browse files
Made the console_progress_indicator::print_status() method return
a bool indicating if it actually printed anything.
parent
2bf68f2c
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
6 deletions
+14
-6
dlib/console_progress_indicator.h
dlib/console_progress_indicator.h
+14
-6
No files found.
dlib/console_progress_indicator.h
View file @
64afd2ec
...
...
@@ -64,7 +64,7 @@ namespace dlib
function returns that targeted value.
!*/
inline
void
print_status
(
inline
bool
print_status
(
double
cur
);
/*!
...
...
@@ -74,8 +74,12 @@ namespace dlib
remaining until cur becomes equal to target().
- prints a status message to the screen which indicates how much
more time is left until cur is equal to target()
- this function throttles the printing so that at most 1 message is
printed each second.
- This function throttles the printing so that at most 1 message is printed
each second. Note that it won't print anything to the screen until about
one second has elapsed. This means that the first call to print_status()
never prints to the screen.
- This function returns true if it prints to the screen and false
otherwise.
!*/
private:
...
...
@@ -109,7 +113,7 @@ namespace dlib
// ----------------------------------------------------------------------------------------
void
console_progress_indicator
::
bool
console_progress_indicator
::
print_status
(
double
cur
)
...
...
@@ -125,7 +129,7 @@ namespace dlib
last_time
=
cur_time
;
first_val
=
cur
;
seen_first_val
=
true
;
return
;
return
false
;
}
if
(
cur_time
!=
last_time
)
...
...
@@ -136,7 +140,7 @@ namespace dlib
// don't do anything if cur is equal to first_val
if
(
delta_val
<
std
::
numeric_limits
<
double
>::
epsilon
())
return
;
return
false
;
double
seconds
=
delta_t
/
delta_val
*
std
::
abs
(
target_val
-
cur
);
...
...
@@ -164,7 +168,11 @@ namespace dlib
// restore previous output flags and precision settings
std
::
cout
.
flags
(
oldflags
);
std
::
cout
.
precision
(
ss
);
return
true
;
}
return
false
;
}
// ----------------------------------------------------------------------------------------
...
...
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