Joutsen v0.5.0+12-g5dd5f7e
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
Joutsen.ConsoleProgressPainter Class Referenceabstract

A base class for writing progress to the console. More...

Public Member Functions

 ConsoleProgressPainter (ushort maxWritesPerSecond=5)
 Creates a new instance with a certain maximum of console updates a second. More...
 
virtual void ProgressUpdate (double completed, double total, double progress)
 Writes the updated progress to the console. More...
 
virtual void DescriptionUpdate (String description)
 Writes the updated description to the console. More...
 
void Paint ()
 Updates the console output. More...
 
virtual void Clear ()
 Resets the painter in order to restart updates to the console. More...
 

Protected Member Functions

abstract void Paint (double completed, double total, double progress, string description)
 In a derived class handles the actual writing to the console. More...
 

Protected Attributes

String description
 The description to write. More...
 
double progress
 The progress value to write. More...
 
double completed
 
double total
 

Detailed Description

A base class for writing progress to the console.

Remarks
Updating the console is notoriously slow. Therefore it can be configured how many times a second the console should be updated at a maximum.
Since
0.4.1

Constructor & Destructor Documentation

◆ ConsoleProgressPainter()

Joutsen.ConsoleProgressPainter.ConsoleProgressPainter ( ushort  maxWritesPerSecond = 5)

Creates a new instance with a certain maximum of console updates a second.

Parameters
maxWritesPerSecondthe maximum number of writes to the console per second, default is 5

Member Function Documentation

◆ Clear()

virtual void Joutsen.ConsoleProgressPainter.Clear ( )
virtual

Resets the painter in order to restart updates to the console.

Reimplemented in Joutsen.ConsoleProgressListPainter.

◆ DescriptionUpdate()

virtual void Joutsen.ConsoleProgressPainter.DescriptionUpdate ( String  description)
virtual

Writes the updated description to the console.

Remarks
this method is usually used as an event handler for the DescriptionChanged event of the progress class.

◆ Paint() [1/2]

void Joutsen.ConsoleProgressPainter.Paint ( )

Updates the console output.

◆ Paint() [2/2]

abstract void Joutsen.ConsoleProgressPainter.Paint ( double  completed,
double  total,
double  progress,
string  description 
)
protectedpure virtual

In a derived class handles the actual writing to the console.

Implemented in Joutsen.ConsoleColoredProgressBarPainter, Joutsen.ConsoleProgressBarPainter, and Joutsen.ConsoleProgressListPainter.

◆ ProgressUpdate()

virtual void Joutsen.ConsoleProgressPainter.ProgressUpdate ( double  completed,
double  total,
double  progress 
)
virtual

Writes the updated progress to the console.

Remarks
this method is usually used as an event handler for the ProgressChanged event of the progress class.

Reimplemented in Joutsen.ConsoleProgressListPainter.

Member Data Documentation

◆ completed

double Joutsen.ConsoleProgressPainter.completed
protected

◆ description

String Joutsen.ConsoleProgressPainter.description
protected

The description to write.

◆ progress

double Joutsen.ConsoleProgressPainter.progress
protected

The progress value to write.

◆ total

double Joutsen.ConsoleProgressPainter.total
protected