Momentum
A library for solving nonlinear optimization problems related to human body kinematics
Loading...
Searching...
No Matches
progress_bar.h
Go to the documentation of this file.
1/*
2 * Copyright (c) Meta Platforms, Inc. and affiliates.
3 *
4 * This source code is licensed under the MIT license found in the
5 * LICENSE file in the root directory of this source tree.
6 */
7
8#pragma once
9
10#include <indicators/progress_bar.hpp>
11
12#include <string>
13
14namespace momentum {
15
22 public:
29 ProgressBar(const std::string& prefix, size_t numOperations);
30
32 void increment(size_t count = 1);
33
35 void set(size_t count);
36
41 [[nodiscard]] size_t getCurrentProgress();
42
43 private:
44 static constexpr size_t kMaxWidth = 80;
45 indicators::ProgressBar bar_;
46};
47
48} // namespace momentum
void set(size_t count)
Sets progress to the absolute value count and redraws the bar.
void increment(size_t count=1)
Advances progress by count (default 1) and redraws the bar.
size_t getCurrentProgress()
Returns the current absolute progress count (not a percentage).
ProgressBar(const std::string &prefix, size_t numOperations)
Constructs the progress bar and renders its initial (zero-progress) state.