Commit 64afd2ec authored by Davis King's avatar Davis King

Made the console_progress_indicator::print_status() method return

a bool indicating if it actually printed anything.
parent 2bf68f2c
......@@ -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;
}
// ----------------------------------------------------------------------------------------
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment