libpappsomspp
Library for mass spectrometry
Toggle main menu visibility
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
"
29
#include "
pappsomspp/core/pappsoexception.h
"
30
#include <QJsonArray>
31
32
void
33
pappso::cbor::mzcbor::CvParamMap::fromQCborArray
(
const
QCborArray &cbor_map)
34
{
35
QString txt_value;
36
for
(
auto
it_binarr = cbor_map.cbegin(); it_binarr != cbor_map.cend(); it_binarr++)
37
{
38
CvParam
cv_param;
39
cv_param.
fromQCborMap
(it_binarr->toMap());
40
insert({cv_param.
accession
, cv_param});
41
}
42
}
43
void
44
pappso::cbor::mzcbor::CvParamMap::fromCbor
(
CborStreamReader
&reader)
45
{
46
47
qDebug();
48
if
(!reader.isArray())
49
{
50
throw
pappso::PappsoException
(
"this is not an array of cvParams"
);
51
}
52
reader.enterContainer();
// start array
53
54
while
(reader.hasNext())
55
{
56
qDebug();
57
CvParam
cv_param;
58
cv_param.
fromCbor
(reader);
59
insert({cv_param.
accession
, cv_param});
60
61
qDebug() << cv_param.
accession
;
62
}
63
64
reader.leaveContainer();
// end array
65
qDebug();
66
}
67
68
69
QJsonArray
70
pappso::cbor::mzcbor::CvParamMap::toJsonArray
()
const
71
{
72
QJsonArray cv_array;
73
for
(
auto
const
&[key, val] : *
this
)
74
{
75
cv_array.append(val.toJsonObject());
76
}
77
78
return
cv_array;
79
}
pappso::PappsoException
Definition
pappsoexception.h:41
pappso::cbor::CborStreamReader
simple override of the raw QCborStreamReader This adds convenient functions to put CBOR data into C++...
Definition
cborstreamreader.h:47
cvparammap.h
cvParam map
pappsoexception.h
pappso::cbor::mzcbor::CvParamMap::fromQCborArray
void fromQCborArray(const QCborArray &reader)
Definition
cvparammap.cpp:33
pappso::cbor::mzcbor::CvParamMap::fromCbor
void fromCbor(CborStreamReader &reader)
fill the structure reading data from a CBOR stream
Definition
cvparammap.cpp:44
pappso::cbor::mzcbor::CvParamMap::toJsonArray
QJsonArray toJsonArray() const
write the structure to a JSON array
Definition
cvparammap.cpp:70
pappso::cbor::mzcbor::CvParam
Definition
cvparam.h:47
pappso::cbor::mzcbor::CvParam::fromCbor
void fromCbor(CborStreamReader &reader)
Definition
cvparam.cpp:92
pappso::cbor::mzcbor::CvParam::accession
QString accession
Definition
cvparam.h:75
pappso::cbor::mzcbor::CvParam::fromQCborMap
void fromQCborMap(const QCborMap &reader)
Definition
cvparam.cpp:36
pappsomspp
core
processing
cbor
mzcbor
cvparammap.cpp
Generated on
for libpappsomspp by
1.17.0