#include <ProgressBar.hpp>
tsm::utils::ProgressBar::ProgressBar |
( |
std::size_t |
expectedIterations, |
|
|
const std::string & |
initialMessage = "" |
|
) |
| |
Constructor. It takes two values: the expected number of iterations whose progress we want to monitor and an initial message to be displayed on top of the bar (which can be updated with updateLastPrintedMessage()).
tsm::utils::ProgressBar::~ProgressBar |
( |
| ) |
|
Destructor to guarantee RAII.
tsm::utils::ProgressBar::ProgressBar |
( |
const ProgressBar & |
o | ) |
|
|
delete |
void tsm::utils::ProgressBar::endProgressBar |
( |
| ) |
|
Must be invoked when the progress bar is no longer needed to restore the position of the cursor to the end of the output. It is automatically invoked when the object is destroyed.
void tsm::utils::ProgressBar::operator++ |
( |
| ) |
|
Overloaded prefix operator, used to indicate that the has been a new iteration.
void tsm::utils::ProgressBar::printNewMessage |
( |
const std::string & |
message | ) |
|
Prints a new message under the last printed message, without overwriting it. This moves the progress bar down to be placed under the newly written message.
void tsm::utils::ProgressBar::updateLastPrintedMessage |
( |
const std::string & |
message | ) |
|
Prints a message while the progress bar is on the screen on top on the last printed message. Since the cursor is right at the beginning of the progress bar, it moves the cursor up by one line before printing, and then returns it to its original position.
bool tsm::utils::ProgressBar::mEnded |
|
private |
std::size_t tsm::utils::ProgressBar::mLengthOfLastPrintedMessage |
|
private |
std::size_t tsm::utils::ProgressBar::mNumberOfTicks |
|
private |
std::size_t tsm::utils::ProgressBar::mTotalIterations |
|
private |
The documentation for this class was generated from the following files: