libpappsomspp
Library for mass spectrometry
Loading...
Searching...
No Matches
uimonitorinterface.h
Go to the documentation of this file.
1/**
2 * \file pappsomspp/processing/uimonitor/uimonitorinterface.h
3 * \date 14/5/2021
4 * \author Olivier Langella
5 * \brief generic interface to monitor any long process
6 * A long process needs to be interrupted by the user and to report progress
7 *while running. This interface is used by long process in this library.
8 **/
9
10/*******************************************************************************
11 * Copyright (c) 2021 Olivier Langella
12 *<Olivier.Langella@universite-paris-saclay.fr>.
13 *
14 * This file is part of the PAPPSOms++ library.
15 *
16 * PAPPSOms++ is free software: you can redistribute it and/or modify
17 * it under the terms of the GNU General Public License as published by
18 * the Free Software Foundation, either version 3 of the License, or
19 * (at your option) any later version.
20 *
21 * PAPPSOms++ is distributed in the hope that it will be useful,
22 * but WITHOUT ANY WARRANTY; without even the implied warranty of
23 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
24 * GNU General Public License for more details.
25 *
26 * You should have received a copy of the GNU General Public License
27 * along with PAPPSOms++. If not, see <http://www.gnu.org/licenses/>.
28 *
29 ******************************************************************************/
30
31#pragma once
32
33#include <numeric>
34#include <QString>
36
37namespace pappso
38{
39
40/**
41 * @todo pure virtual user interface class to monitor any long process
42 * it contains :
43 * - title, status, progress messages
44 * - callback functions to interrupt long process
45 * it does not contains any error messages functions : use
46 * pappso::ExceptionInterrupted to handle this
47 *
48 */
50{
51 public:
52 /** @brief should the procces be stopped ?
53 * If true, then cancel process
54 * Use this function at strategic point of your process in order to interrupt
55 * it cleanly
56 * Implementation **must** take care of thread resistance if implemented
57 */
58 virtual bool shouldIstop() = 0;
59
60 /** @brief use it if the number of steps is known in an algorithm
61 * the total number of steps is usefull to report to the user a progress
62 * message in percents or with a progress bar
63 * @param total_number_of_steps the total number of steps
64 */
65 virtual void
66 setTotalSteps(std::size_t total_number_of_steps)
67 {
68 m_totalSteps = total_number_of_steps;
69 };
70
71 /** @brief count steps
72 * report when a step is computed in an algorithm
73 */
74 virtual void count() = 0;
75
76 /** @brief current kind of process running
77 * @param title process title
78 */
79 virtual void setTitle(const QString &title) = 0;
80
81 /** @brief current status of the process
82 * @param status status message
83 */
84 virtual void setStatus(const QString &status) = 0;
85
86 /** @brief append a text to a long report
87 * @param text string to append in a long report
88 */
89 virtual void appendText(const QString &text) = 0;
90
91 protected:
92 std::size_t m_totalSteps = 0;
93};
94} // namespace pappso
virtual void setStatus(const QString &status)=0
current status of the process
virtual void appendText(const QString &text)=0
append a text to a long report
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...
virtual bool shouldIstop()=0
should the procces be stopped ? If true, then cancel process Use this function at strategic point of ...
virtual void count()=0
count steps report when a step is computed in an algorithm
virtual void setTitle(const QString &title)=0
current kind of process running
#define PMSPP_LIB_DECL
tries to keep as much as possible monoisotopes, removing any possible C13 peaks and changes multichar...
Definition aa.cpp:39