libpappsomspp
Library for mass spectrometry
Toggle main menu visibility
Loading...
Searching...
No Matches
uimonitortextpercent.cpp
Go to the documentation of this file.
1
/**
2
* \file pappsomspp/processing/uimonitor/uimonitortextpercent.cpp
3
* \date 25/9/2021
4
* \author Olivier Langella
5
* \brief simle text monitor implementation of the User Interface Monitor
6
*displaying percent progression
7
**/
8
9
/*******************************************************************************
10
* Copyright (c) 2021 Olivier Langella
11
*<Olivier.Langella@universite-paris-saclay.fr>.
12
*
13
* This file is part of the PAPPSOms++ library.
14
*
15
* PAPPSOms++ is free software: you can redistribute it and/or modify
16
* it under the terms of the GNU General Public License as published by
17
* the Free Software Foundation, either version 3 of the License, or
18
* (at your option) any later version.
19
*
20
* PAPPSOms++ is distributed in the hope that it will be useful,
21
* but WITHOUT ANY WARRANTY; without even the implied warranty of
22
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
23
* GNU General Public License for more details.
24
*
25
* You should have received a copy of the GNU General Public License
26
* along with PAPPSOms++. If not, see <http://www.gnu.org/licenses/>.
27
*
28
******************************************************************************/
29
30
#include "
uimonitortextpercent.h
"
31
#include <QDebug>
32
33
using namespace
pappso
;
34
35
UiMonitorTextPercent::UiMonitorTextPercent
(QTextStream &output_stream)
36
:
UiMonitorText
(output_stream)
37
{
38
m_unit
= -1;
39
m_totalSteps
= 1;
40
}
41
42
UiMonitorTextPercent::~UiMonitorTextPercent
()
43
{
44
}
45
46
47
void
48
pappso::UiMonitorTextPercent::setTotalSteps
(std::size_t total_number_of_steps)
49
{
50
if
(
m_count
> 0)
51
{
52
53
m_outputStream
<< Qt::endl;
54
m_outputStream
.flush();
55
}
56
UiMonitorText::setTotalSteps
(total_number_of_steps);
57
m_unit
= -1;
58
if
(
m_totalSteps
== 0)
59
{
60
m_totalSteps
= -1;
61
}
62
}
63
64
void
65
pappso::UiMonitorTextPercent::count
()
66
{
67
m_count
++;
68
if
(
m_count
<=
m_totalSteps
)
69
{
70
int
unit = (int)(((
float
)
m_count
/ (
float
)
m_totalSteps
) * 10);
71
// qDebug() << unit;
72
if
(unit >
m_unit
)
73
{
74
m_outputStream
<< (unit * 10) <<
"% "
;
75
m_outputStream
.flush();
76
m_unit
= unit;
77
}
78
}
79
}
pappso::UiMonitorInterface::m_totalSteps
std::size_t m_totalSteps
Definition
uimonitorinterface.h:92
pappso::UiMonitorTextPercent::count
virtual void count() override
count steps report when a step is computed in an algorithm
Definition
uimonitortextpercent.cpp:65
pappso::UiMonitorTextPercent::~UiMonitorTextPercent
virtual ~UiMonitorTextPercent()
Definition
uimonitortextpercent.cpp:42
pappso::UiMonitorTextPercent::m_unit
int m_unit
Definition
uimonitortextpercent.h:67
pappso::UiMonitorTextPercent::UiMonitorTextPercent
UiMonitorTextPercent(QTextStream &output_stream)
Definition
uimonitortextpercent.cpp:35
pappso::UiMonitorTextPercent::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
uimonitortextpercent.cpp:48
pappso::UiMonitorText::m_outputStream
QTextStream & m_outputStream
Definition
uimonitortext.h:80
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
pappso::UiMonitorText::UiMonitorText
UiMonitorText(QTextStream &output_stream)
Definition
uimonitortext.cpp:35
pappso::UiMonitorText::m_count
std::size_t m_count
Definition
uimonitortext.h:81
pappso
tries to keep as much as possible monoisotopes, removing any possible C13 peaks and changes multichar...
Definition
aa.cpp:39
uimonitortextpercent.h
pappsomspp
core
processing
uimonitor
uimonitortextpercent.cpp
Generated on
for libpappsomspp by
1.17.0