Class ProgressCounter

Class Documentation

class ProgressCounter

A progress counter class.

This class can be used of the number of performed operations is not known in advance (e.g. ASCII file reading). After m_stepVal} operations the current counter is printed.

Public Functions

ProgressCounter(int stepVal, string prefix = "")
void operator++()

Protected Functions

void print_progress()

Prints the current state.

Protected Attributes

string m_prefix

The prefix string.

size_t m_stepVal

The step value for output generation.

size_t m_currentVal

The current counter value.

boost::mutex m_mutex

A mutex object for counter increment (for parallel executions)

stringstream m_stream

A string stream for output generation.

string m_fillstring

A fill string for correct output alignment.