Class ProgressBar#

Class Documentation#

class ProgressBar#

Progress bar for tracking tasks.

Public Functions

explicit ProgressBar(int task_count, std::string name = "")#

Construct a progress bar.

Parameters:
  • task_count – Total task count (at least 1).

  • name – Progress bar name (default is an empty string).

void set_bar_width(int bar_width)#

Set progress bar width.

Parameters:

bar_width – Progress bar width (at least 1).

void set_nodes(std::vector<float> nodes)#

Set progress bar width.

Parameters:

nodes – Progress values (strictly increasing in the interval [0, 1]) at which the bar is updated.

void set_task_idx(int task_idx)#

Set current (or initial) task index.

Note

When the tas index is zero, it means no task has completed yet.

Parameters:

task_idx – Current task index within the total task count.

void set_progress(float progress)#

Set current (or initial) progress value.

Parameters:

progress – Current progress value in the interval [0, 1].

void update(int task_idx_now)#

Update the progress bar.

Note

When the tas index is zero, it means no task has completed yet.

Parameters:

task_idx_now – Latest completed task index.

void update(float progress_now)#

Update the progress bar.

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Parameters:

progress_now – Latest progress value.

Public Members

std::string name#

progress bar name

int task_count = 1#

total task count

int task_idx = 0#

task index

float progress = 0.#

progress value in [0, 1] interval