pappso::UiMonitorTextPercent Class Reference

`#include <uimonitortextpercent.h>`

Inheritance diagram for pappso::UiMonitorTextPercent:

## Public Member Functions

| UiMonitorTextPercent (QTextStream &output_stream)
virtual | ~UiMonitorTextPercent ()
virtual void | count () override
| count steps report when a step is computed in an algorithm More...
virtual void | setTotalSteps (std::size_t total_number_of_steps)
| use it if the number of steps is known in an algorithm the total number of steps is usefull to report to the user a progress message in percents or with a progress bar More...
Public Member Functions inherited from pappso::UiMonitorText
| UiMonitorText (QTextStream &output_stream)
| ~UiMonitorText ()
virtual bool | shouldIstop () override
| should the procces be stopped ? If true, then cancel process Use this function at strategic point of your process in order to interrupt it cleanly Implementation must take care of thread resistance if implemented More...
virtual void | setTitle (const QString &title) override
| current kind of process running More...
virtual void | setStatus (const QString &status) override
| current status of the process More...
virtual void | appendText (const QString &text) override
| append a text to a long report More...

## Protected Attributes

int | m_unit
Protected Attributes inherited from pappso::UiMonitorText
QTextStream & | m_outputStream
std::size_t | m_count = 0
Protected Attributes inherited from pappso::UiMonitorInterface
std::size_t | m_totalSteps = 0

## Detailed Description

Todo:
  write docs

Definition at line 43 of file uimonitortextpercent.h.

## Constructor & Destructor Documentation

## UiMonitorTextPercent()

UiMonitorTextPercent::UiMonitorTextPercent | ( | QTextStream & | output_stream | ) |

Default constructor

Definition at line 35 of file uimonitortextpercent.cpp.

: UiMonitorText(output_stream)
{
m_unit = -1;
m_totalSteps = 1;
}
pappso::UiMonitorInterface::m_totalSteps
std::size_t m_totalSteps
Definition: uimonitorinterface.h:92
pappso::UiMonitorTextPercent::m_unit
int m_unit
Definition: uimonitortextpercent.h:67
pappso::UiMonitorText::UiMonitorText
UiMonitorText(QTextStream &output_stream)
Definition: uimonitortext.cpp:33

References pappso::UiMonitorInterface::m_totalSteps, and m_unit.

## ~UiMonitorTextPercent()

UiMonitorTextPercent::~UiMonitorTextPercent | ( |  | ) |

virtual

Destructor

Definition at line 42 of file uimonitortextpercent.cpp.

{
}

## Member Function Documentation

## count()

void pappso::UiMonitorTextPercent::count | ( |  | ) |

override virtual

count steps report when a step is computed in an algorithm

Reimplemented from pappso::UiMonitorText.

Definition at line 65 of file uimonitortextpercent.cpp.

{
m_count++;
if(m_count <= m_totalSteps)
{
int unit = (int)(((float)m_count / (float)m_totalSteps) * 10);
// qDebug() << unit;
if(unit > m_unit)
{
m_outputStream << (unit * 10) << "% ";
m_outputStream.flush();
m_unit = unit;
}
}
}
pappso::UiMonitorText::m_outputStream
QTextStream & m_outputStream
Definition: uimonitortext.h:80
pappso::UiMonitorText::m_count
std::size_t m_count
Definition: uimonitortext.h:81

## setTotalSteps()

void pappso::UiMonitorTextPercent::setTotalSteps | ( | std::size_t | total_number_of_steps | ) |

virtual

use it if the number of steps is known in an algorithm the total number of steps is usefull to report to the user a progress message in percents or with a progress bar

Parameters

  total_number_of_steps | the total number of steps

Reimplemented from pappso::UiMonitorText.

Definition at line 48 of file uimonitortextpercent.cpp.

{
if(m_count > 0)
{
m_outputStream << Qt::endl;
m_outputStream.flush();
}
UiMonitorText::setTotalSteps(total_number_of_steps);
m_unit = -1;
if(m_totalSteps == 0)
{
m_totalSteps = -1;
}
}
pappso::UiMonitorText::setTotalSteps
virtual void setTotalSteps(std::size_t total_number_of_steps)
use it if the number of steps is known in an algorithm the total number of steps is usefull to report...
Definition: uimonitortext.cpp:87

References pappso::UiMonitorText::setTotalSteps().

## Member Data Documentation

## m_unit

int pappso::UiMonitorTextPercent::m_unit

protected

Definition at line 67 of file uimonitortextpercent.h.

Referenced by UiMonitorTextPercent().

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

- pappsomspp/processing/uimonitor/uimonitortextpercent.h
- pappsomspp/processing/uimonitor/uimonitortextpercent.cpp