41 using std::stringstream;
63 index = prefix.find_last_of(
"]");
85 boost::mutex::scoped_lock lock(
m_mutex);
94 while (difference >= 1)
110 boost::mutex::scoped_lock lock(
m_mutex);
119 while (difference >= 1)
147 boost::mutex::scoped_lock lock(
m_mutex);
166 ,m_bar_length(bar_length)
176 index = prefix.find_last_of(
"]");
198 boost::mutex::scoped_lock lock(
m_mutex);
208 while (difference >= 1)
228 for(
size_t i=0; i< char_idx; i++)
233 if(char_idx % 2 == 0)
250 cout <<
" | " << flush;
string m_prefix
The prefix string.
static PacmanProgressTitleCallbackPtr m_titleCallback
void(* PacmanProgressCallbackPtr)(int)
A class to manage progress information output for process where the number of performed operations is...
int m_percent
The current progress in percent.
void(* ProgressCallbackPtr)(int)
A class to manage progress information output for process where the number of performed operations is...
PacmanProgressBar(size_t max_val, string prefix="", size_t bar_length=60)
Ctor.
size_t m_maxVal
The number of iterations.
static PacmanProgressCallbackPtr m_progressCallback
size_t m_currentVal
The current counter.
ProgressBar(size_t max_val, string prefix="")
Ctor.
void print_bar()
Prints the output.
string m_prefix
The prefix string.
void(* ProgressTitleCallbackPtr)(string)
size_t m_maxVal
The number of iterations.
void operator+=(size_t n)
Increases the counter of performed by n.
size_t m_currentVal
The current counter.
void(* PacmanProgressTitleCallbackPtr)(string)
static ProgressCallbackPtr m_progressCallback
static ProgressTitleCallbackPtr m_titleCallback
static void setProgressCallback(ProgressCallbackPtr)
Registers a callback that is called with the new value when the percentage of the progress changed...
int m_percent
The current progress in percent.
void operator++()
Increases the counter of performed iterations.
static void setProgressCallback(ProgressCallbackPtr)
Registers a callback that is called with the new value when the percentage of the progress changed...
static void setProgressTitleCallback(ProgressTitleCallbackPtr)
Registers a callback that is called when a new progress instance is created.
void print_bar()
Prints the output.
void operator++()
Increases the counter of performed iterations.
void print_progress()
Prints the current state.
boost::mutex m_mutex
A mutex object for counter increment (for parallel executions)
boost::mutex m_mutex
A mutex object for counter increment (for parallel executions)
ProgressCounter(int stepVal, string prefix="")
virtual ~PacmanProgressBar()
static void setProgressTitleCallback(ProgressTitleCallbackPtr)
Registers a callback that is called when a new progress instance is created.