Public Member Functions | Protected Member Functions | Protected Attributes

lssr::ProgressBar Class Reference

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>

Collaboration diagram for lssr::ProgressBar:
Collaboration graph
[legend]

List of all members.

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.

Detailed Description

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.


Constructor & Destructor Documentation

lssr::ProgressBar::ProgressBar ( int  max_val,
string  prefix = "" 
)

Ctor.

Parameters:
max_val The number of performed iterations
prefix The prefix string for progress output

Definition at line 21 of file Progress.cpp.


Member Function Documentation

void lssr::ProgressBar::operator++ (  ) 

Increases the counter of performed iterations.

Definition at line 30 of file Progress.cpp.

Here is the call graph for this function:

void lssr::ProgressBar::print_bar (  )  [protected]

Prints the output.

Definition at line 41 of file Progress.cpp.

Here is the caller graph for this function:


Member Data Documentation

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.

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.


The documentation for this class was generated from the following files:
 All Classes Files Functions Variables Typedefs Defines