MCPcopy Create free account
hub / github.com/davisking/dlib / console_progress_indicator

Class console_progress_indicator

dlib/console_progress_indicator.h:16–108  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

14// ----------------------------------------------------------------------------------------
15
16 class console_progress_indicator
17 {
18 /*!
19 WHAT THIS OBJECT REPRESENTS
20 This object is a tool for reporting how long a task will take
21 to complete.
22
23 For example, consider the following bit of code:
24
25 console_progress_indicator pbar(100)
26 for (int i = 1; i <= 100; ++i)
27 {
28 pbar.print_status(i);
29 long_running_operation();
30 }
31
32 The above code will print a message to the console each iteration
33 which shows the current progress and how much time is remaining until
34 the loop terminates.
35 !*/
36
37 public:
38
39 inline explicit console_progress_indicator (
40 double target_value
41 );
42 /*!
43 ensures
44 - #target() == target_value
45 !*/
46
47 inline void reset (
48 double target_value
49 );
50 /*!
51 ensures
52 - #target() == target_value
53 - performs the equivalent of:
54 *this = console_progress_indicator(target_value)
55 (i.e. resets this object with a new target value)
56
57 !*/
58
59 inline double target (
60 ) const;
61 /*!
62 ensures
63 - This object attempts to measure how much time is
64 left until we reach a certain targeted value. This
65 function returns that targeted value.
66 !*/
67
68 inline bool print_status (
69 double cur,
70 bool always_print = false,
71 std::ostream& out = std::clog
72 );
73 /*!

Callers 1

resetMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected