libpappsomspp
Library for mass spectrometry
Loading...
Searching...
No Matches
cvparammap.cpp
Go to the documentation of this file.
1/**
2 * \file pappsomspp/core/processing/cbor/mzcbor/cvparammap.cpp
3 * \date 02/02/2026
4 * \author Olivier Langella
5 * \brief cvParam map
6 */
7
8/*******************************************************************************
9 * Copyright (c) 2026 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#include "cvparammap.h"
30#include <QJsonArray>
31
32void
34{
35
36 qDebug();
37 if(!reader.isArray())
38 {
39 throw pappso::PappsoException("this is not an array of cvParams");
40 }
41 reader.enterContainer(); // start array
42
43 while(reader.hasNext())
44 {
45 qDebug();
46 CvParam cv_param;
47 cv_param.fromCbor(reader);
48 insert({cv_param.accession, cv_param});
49
50 qDebug() << cv_param.accession;
51 }
52
53 reader.leaveContainer(); // end array
54 qDebug();
55}
56
57
58QJsonArray
60{
61 QJsonArray cv_array;
62 for(auto const &[key, val] : *this)
63 {
64 cv_array.append(val.toJsonObject());
65 }
66
67 return cv_array;
68}
simple override of the raw QCborStreamReader This adds convenient functions to put CBOR data into C++...
cvParam map
void fromCbor(CborStreamReader &reader)
fill the structure reading data from a CBOR stream
QJsonArray toJsonArray() const
write the structure to a JSON array
void fromCbor(CborStreamReader &reader)
Definition cvparam.cpp:36