Momentum
A library for solving nonlinear optimization problems related to human body kinematics
Loading...
Searching...
No Matches
momentum::ProgressBar Class Reference

A terminal progress bar rendered as Name [===> ] 60%. More...

#include <progress_bar.h>

Public Member Functions

 ProgressBar (const std::string &prefix, size_t numOperations)
 Constructs the progress bar and renders its initial (zero-progress) state.
void increment (size_t count=1)
 Advances progress by count (default 1) and redraws the bar.
void set (size_t count)
 Sets progress to the absolute value count and redraws the bar.
size_t getCurrentProgress ()
 Returns the current absolute progress count (not a percentage).

Detailed Description

A terminal progress bar rendered as Name [===> ] 60%.

Wraps indicators::ProgressBar with a fixed visual style (bold, percentage shown). All mutating operations write to the terminal (stdout) as a side effect. Not thread-safe.

Definition at line 21 of file progress_bar.h.

Constructor & Destructor Documentation

◆ ProgressBar()

momentum::ProgressBar::ProgressBar ( const std::string & prefix,
size_t numOperations )

Constructs the progress bar and renders its initial (zero-progress) state.

Parameters
prefixText shown before the bar.
numOperationsTotal operation count corresponding to 100%.
Exceptions
std::invalid_argumentif prefix.size() + 9 >= kMaxWidth, since the bar width would otherwise underflow size_t.

Definition at line 15 of file progress_bar.cpp.

Member Function Documentation

◆ getCurrentProgress()

size_t momentum::ProgressBar::getCurrentProgress ( )
nodiscard

Returns the current absolute progress count (not a percentage).

The value is in the range [0, numOperations] as supplied to the constructor.

Definition at line 50 of file progress_bar.cpp.

◆ increment()

void momentum::ProgressBar::increment ( size_t count = 1)

Advances progress by count (default 1) and redraws the bar.

Definition at line 42 of file progress_bar.cpp.

Referenced by momentum::trackPosesForFrames().

◆ set()

void momentum::ProgressBar::set ( size_t count)

Sets progress to the absolute value count and redraws the bar.

Definition at line 46 of file progress_bar.cpp.


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