$darkmode
engine::Progress Class Reference

Public Types

using Clock = std::chrono::steady_clock
 
using TimePoint = std::chrono::steady_clock::time_point
 
using Duration = cloe::Duration
 

Public Member Functions

void begin ()
 
void end ()
 
bool is_ended () const
 
void update (double p)
 
void update_safe (double p)
 
double percent () const
 
Duration eta () const
 
Duration elapsed () const
 

Friends

void to_json (cloe::Json &j, const Progress &e)
 

Member Function Documentation

◆ begin()

void engine::Progress::begin ( )
inline

Reset the clock to now.

This does not alter the current progress bar, because that is anyways overwritten with each update.

◆ elapsed()

Duration engine::Progress::elapsed ( ) const
inline

Return the elapsed time since the beginning or the final elapsed time.

◆ end()

void engine::Progress::end ( )
inline

Set the clock to terminate now.

This is better than calling update(1.0) because there are no rounding errors that can occur here. Also, this also stores the termination time which effectively saves the elapsed time.

◆ eta()

Duration engine::Progress::eta ( ) const
inline

Return the expected remaining duration.

◆ is_ended()

bool engine::Progress::is_ended ( ) const
inline

Return true if end() was called for this progress.

Here is the caller graph for this function:

◆ percent()

double engine::Progress::percent ( ) const
inline

Return the current progress as a percentage between 0.0 and 1.0.

Here is the caller graph for this function:

◆ update()

void engine::Progress::update ( double  p)
inline

Update the progress with a value between 0.0 and 1.0.

Here is the caller graph for this function:

◆ update_safe()

void engine::Progress::update_safe ( double  p)
inline

Update the progress with a value that is corrected to between 0.0 and 1.0.

Here is the call graph for this function:

The documentation for this class was generated from the following file: