SynAPSE  0.6.0
Synergistic Analysis of Phase Space Evolution
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends
Public Member Functions | Private Member Functions | Private Attributes
ProgressBar Class Reference

Provides a progess bar to be included in a for loop. More...

#include <ProgressBar.hh>

Public Member Functions

 ProgressBar (Pitch::errorLevel level=Pitch::info)
 Default constructor, sets the output to Pitch::info. More...
 
 ProgressBar (const ProgressBar &pbar)
 Copy constructor. More...
 
ProgressBar & operator= (const ProgressBar &pbar)
 Equality operator. More...
 
 ~ProgressBar ()
 Destructor. More...
 
void SetStartTime (time_stamp start)
 Sets the start of execution time. More...
 
const time_stamp & GetStartTime ()
 Gets the start of execution time. More...
 
void SetCurrentTime (time_stamp current)
 Sets the current time. More...
 
const time_stamp & GetCurrentTime ()
 Gets the current time. More...
 
void SetTerminalWidth (size_t twidth)
 Sets the width of the terminal. More...
 
const size_t & GetTerminalWidth ()
 Gets the width of the terminal. More...
 
void SetVerbosityLevel (Pitch::errorLevel level)
 Sets the verbosity level. More...
 
const Pitch::errorLevel & GetVerbosityLevel ()
 Gets the verbosity level. More...
 
void GetProgress (const size_t n, const size_t N)
 Prints the current progress in the terminal. More...
 

Private Member Functions

void FetchTerminalWidth ()
 Fetch the terminal width from the OS. More...
 
void PrintProgress (const size_t pc, const size_t n)
 Prints the bar for a given percentage of progress. More...
 

Private Attributes

time_stamp _start
 Start time. More...
 
time_stamp _current
 Current time. More...
 
size_t _twidth
 Terminal width. More...
 
Pitch::errorLevel _level
 Verbosity level. More...
 

Detailed Description

Provides a progess bar to be included in a for loop.

It defines a progress bar for that adapts to the terminal width, prints the rate of progress and the estimated time of arrival.

Constructor & Destructor Documentation

ProgressBar::ProgressBar ( Pitch::errorLevel  level = Pitch::info)

Default constructor, sets the output to Pitch::info.

ProgressBar::ProgressBar ( const ProgressBar &  pbar)

Copy constructor.

ProgressBar::~ProgressBar ( )

Destructor.

Member Function Documentation

void ProgressBar::FetchTerminalWidth ( )
private

Fetch the terminal width from the OS.

const time_stamp& ProgressBar::GetCurrentTime ( )
inline

Gets the current time.

void ProgressBar::GetProgress ( const size_t  n,
const size_t  N 
)

Prints the current progress in the terminal.

Parameters
nCurrent entry being processed (0->(N-1))
NTotal number of entries to process
const time_stamp& ProgressBar::GetStartTime ( )
inline

Gets the start of execution time.

const size_t& ProgressBar::GetTerminalWidth ( )
inline

Gets the width of the terminal.

const Pitch::errorLevel& ProgressBar::GetVerbosityLevel ( )
inline

Gets the verbosity level.

ProgressBar & ProgressBar::operator= ( const ProgressBar &  pbar)

Equality operator.

void ProgressBar::PrintProgress ( const size_t  pc,
const size_t  n 
)
private

Prints the bar for a given percentage of progress.

Parameters
pcPercentage of progress
nNumber of entries processed
void ProgressBar::SetCurrentTime ( time_stamp  current)
inline

Sets the current time.

void ProgressBar::SetStartTime ( time_stamp  start)
inline

Sets the start of execution time.

void ProgressBar::SetTerminalWidth ( size_t  twidth)
inline

Sets the width of the terminal.

void ProgressBar::SetVerbosityLevel ( Pitch::errorLevel  level)
inline

Sets the verbosity level.

Field Documentation

time_stamp ProgressBar::_current
private

Current time.

Pitch::errorLevel ProgressBar::_level
private

Verbosity level.

time_stamp ProgressBar::_start
private

Start time.

size_t ProgressBar::_twidth
private

Terminal width.


The documentation for this class was generated from the following files: