libpappsomspp
Library for mass spectrometry
Loading...
Searching...
No Matches
psmfilescanprocess.cpp
Go to the documentation of this file.
1/**
2 * \file pappsomspp/processing/cbor/psm/psmfilescanprocess.h
3 * \date 12/07/2025
4 * \author Olivier Langella
5 * \brief PSM file reader designed to parallelize scan process
6 */
7
8/*******************************************************************************
9 * Copyright (c) 2025 Olivier Langella <Olivier.Langella@universite-paris-saclay.fr>.
10 *
11 * This file is part of PAPPSOms-tools.
12 *
13 * PAPPSOms-tools is free software: you can redistribute it and/or modify
14 * it under the terms of the GNU General Public License as published by
15 * the Free Software Foundation, either version 3 of the License, or
16 * (at your option) any later version.
17 *
18 * PAPPSOms-tools is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU General Public License for more details.
22 *
23 * You should have received a copy of the GNU General Public License
24 * along with PAPPSOms-tools. If not, see <http://www.gnu.org/licenses/>.
25 *
26 ******************************************************************************/
27
28
29#include "psmfilescanprocess.h"
31#include <QtConcurrent>
32
33
34namespace pappso
35{
36namespace cbor
37{
38namespace psm
39{
40
41PsmFileScanProcess::PsmFileScanProcess(std::size_t buffer_scan_size)
42{
43 m_bufferScanSize = buffer_scan_size;
44}
45
49
50void
52{
53 for(CborScanMapBase *cbor_scan_p : m_cborScanList)
54 {
55 delete cbor_scan_p;
56 }
57 m_cborScanList.clear();
58}
59
60
61void
63{
64 qDebug();
65 // auto& ref = elections.emplace_back("Nelson Mandela", "South Africa", 1994);
66 CborScanMapBase *scan_map_p = newCborScanMap();
67 m_cborScanList.push_back(scan_map_p);
68
69 if(!mpa_cborReader->readCborMap(*scan_map_p))
70 {
71 throw pappso::PappsoException(QObject::tr("readCborMap scan failed"));
72 }
73 // m_cborScanList.push_back(scan_map);
74 qDebug() << "scan end";
75 scanFinished(monitor);
76 qDebug();
77}
78
79void
88
89void
95
96
97void
99{
100 // you decide how to process the list of scans
101
102 std::function<void(CborScanMapBase *)> mapProcessCborScan = [](CborScanMapBase *cbor_scan_p) {
103 cbor_scan_p->process();
104 };
105
106
107 QFuture<void> res = QtConcurrent::map<std::vector<CborScanMapBase *>::iterator>(
108 m_cborScanList.begin(), m_cborScanList.end(), mapProcessCborScan);
109 res.waitForFinished();
110 processBufferScanDone(monitor);
111}
112
113void
115{
116 // you decide what to do with processed scans
117}
118
119} // namespace psm
120} // namespace cbor
121} // namespace pappso
std::vector< CborScanMapBase * > m_cborScanList
void scanFinished(pappso::UiMonitorInterface &monitor) override
void readScan(pappso::UiMonitorInterface &monitor) override
void sampleFinished(pappso::UiMonitorInterface &monitor) override
virtual void processBufferScanDone(pappso::UiMonitorInterface &monitor)
PsmFileScanProcess(std::size_t buffer_scan_size)
virtual void processBufferScan(pappso::UiMonitorInterface &monitor)
virtual CborScanMapBase * newCborScanMap()=0
tries to keep as much as possible monoisotopes, removing any possible C13 peaks and changes multichar...
Definition aa.cpp:39