libpappsomspp
Library for mass spectrometry
Loading...
Searching...
No Matches
pappso::cbor::mzcbor::CvParamMap Struct Reference

#include <cvparammap.h>

Inheritance diagram for pappso::cbor::mzcbor::CvParamMap:

Public Member Functions

void fromCbor (CborStreamReader &reader)
 fill the structure reading data from a CBOR stream
void fromQCborArray (const QCborArray &reader)
QJsonArray toJsonArray () const
 write the structure to a JSON array

Detailed Description

Todo
write docs

Definition at line 45 of file cvparammap.h.

Member Function Documentation

◆ fromCbor()

void pappso::cbor::mzcbor::CvParamMap::fromCbor ( CborStreamReader & reader)

fill the structure reading data from a CBOR stream

Parameters
readerCBOR stream

Definition at line 44 of file cvparammap.cpp.

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}

References pappso::cbor::mzcbor::CvParam::accession, and pappso::cbor::mzcbor::CvParam::fromCbor().

Referenced by pappso::cbor::mzcbor::Spectrum::readScanCvParams(), and pappso::cbor::mzcbor::ConvertToMzml::writeElementInMzml().

◆ fromQCborArray()

void pappso::cbor::mzcbor::CvParamMap::fromQCborArray ( const QCborArray & reader)

Definition at line 33 of file cvparammap.cpp.

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}

References pappso::cbor::mzcbor::CvParam::accession, and pappso::cbor::mzcbor::CvParam::fromQCborMap().

◆ toJsonArray()

QJsonArray pappso::cbor::mzcbor::CvParamMap::toJsonArray ( ) const

write the structure to a JSON array

Returns
QJsonObject

Definition at line 70 of file cvparammap.cpp.

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}

The documentation for this struct was generated from the following files: