NetCDF Timestamp Mapper  1.0
Maps timestamps (and variables) to netCDF files using sqlite3.
tsm::utils::ProgressBar Class Reference

#include <ProgressBar.hpp>

Public Member Functions

 ProgressBar (std::size_t expectedIterations, const std::string &initialMessage="")
 
 ~ProgressBar ()
 
 ProgressBar (const ProgressBar &o)=delete
 
ProgressBaroperator= (const ProgressBar &o)=delete
 
void endProgressBar ()
 
void printNewMessage (const std::string &message)
 
void updateLastPrintedMessage (const std::string &message)
 
void operator++ ()
 

Private Attributes

std::size_t mTotalIterations
 
std::size_t mNumberOfTicks
 
bool mEnded
 
std::size_t mLengthOfLastPrintedMessage
 

Constructor & Destructor Documentation

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

Member Function Documentation

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.

ProgressBar& tsm::utils::ProgressBar::operator= ( const ProgressBar o)
delete
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.

Member Data Documentation

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: