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
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 33 of file cvparammap.cpp.

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}

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().

◆ toJsonArray()

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

write the structure to a JSON array

Returns
QJsonObject

Definition at line 59 of file cvparammap.cpp.

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}

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