A class to manage progress information output for process where the number of performed operations is known in advance, e.g. number of loop iterations. More...
#include <Progress.hpp>
Public Member Functions | |
ProgressBar (int max_val, string prefix="") | |
Ctor. | |
void | operator++ () |
Increases the counter of performed iterations. | |
Protected Member Functions | |
void | print_bar () |
Prints the output. | |
Protected Attributes | |
string | m_prefix |
The prefix string. | |
size_t | m_maxVal |
The number of iterations. | |
size_t | m_currentVal |
The current counter. | |
size_t | m_stepSize |
The step size (in percent) after which an output is generated. | |
boost::mutex | m_mutex |
A mutex object for counter increment (for parallel executions). | |
int | m_percent |
The current progress in percent. | |
stringstream | m_stream |
A string stream for output generation. | |
string | m_fillstring |
A fill string for correct output alignment. |
A class to manage progress information output for process where the number of performed operations is known in advance, e.g. number of loop iterations.
After each iteration the ++-operator should be called. The progress information in '' is automatically printed to stdout together with the given prefix string.
Definition at line 34 of file Progress.hpp.
lssr::ProgressBar::ProgressBar | ( | int | max_val, | |
string | prefix = "" | |||
) |
Ctor.
max_val | The number of performed iterations | |
prefix | The prefix string for progress output |
Definition at line 21 of file Progress.cpp.
void lssr::ProgressBar::operator++ | ( | ) |
Increases the counter of performed iterations.
Definition at line 30 of file Progress.cpp.
void lssr::ProgressBar::print_bar | ( | ) | [protected] |
Prints the output.
Definition at line 41 of file Progress.cpp.
size_t lssr::ProgressBar::m_currentVal [protected] |
The current counter.
Definition at line 63 of file Progress.hpp.
string lssr::ProgressBar::m_fillstring [protected] |
A fill string for correct output alignment.
Definition at line 78 of file Progress.hpp.
size_t lssr::ProgressBar::m_maxVal [protected] |
The number of iterations.
Definition at line 60 of file Progress.hpp.
boost::mutex lssr::ProgressBar::m_mutex [protected] |
A mutex object for counter increment (for parallel executions).
Definition at line 69 of file Progress.hpp.
int lssr::ProgressBar::m_percent [protected] |
The current progress in percent.
Definition at line 72 of file Progress.hpp.
string lssr::ProgressBar::m_prefix [protected] |
The prefix string.
Definition at line 57 of file Progress.hpp.
size_t lssr::ProgressBar::m_stepSize [protected] |
The step size (in percent) after which an output is generated.
Definition at line 66 of file Progress.hpp.
stringstream lssr::ProgressBar::m_stream [protected] |
A string stream for output generation.
Definition at line 75 of file Progress.hpp.