libpappsomspp
Library for mass spectrometry
Loading...
Searching...
No Matches
cborstreamwriter.h
Go to the documentation of this file.
1/**
2 * \file pappsomspp/processing/cbor/cborstreamwriter.h
3 * \date 05/07/2025
4 * \author Olivier Langella
5 * \brief PAPPSO CBOR stream writer
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#pragma once
28
29#include <QCborStreamWriter>
30#include <QCborMap>
31
32
36
37
38namespace pappso
39{
40namespace cbor
41{
42/** @brief overrides QCborStreamWriter base class to provide convenient functions
43 */
44class PMSPP_LIB_DECL CborStreamWriter : public QCborStreamWriter
45{
46 public:
47 /**
48 * Default constructor
49 */
50 CborStreamWriter(QByteArray *data);
51 CborStreamWriter(QIODevice *device);
52
53 /**
54 * Destructor
55 */
56 virtual ~CborStreamWriter();
57
58
59 /** @brief get UUID intialized when using @ref writeInformations
60 * @return QString for the UUID
61 */
62 const QString &getUuid() const;
63
64 /** @brief automatically produces an informations CBOR map
65 * the "informations" map contains default parameters : software, versions, UUID
66 */
67 void writeInformations(const QString &software_name,
68 const QString &software_version,
69 const QString &type,
70 const QString &operation);
71
72
73 void writeCborMap(const QCborMap &cbor_map);
74 void writeCborArray(const QCborArray &cbor_array);
75 void writeArray(const std::vector<std::size_t> &int_list);
76 void writeArray(const std::vector<qint64> &int_list);
77 void writeArray(const std::vector<double> &double_list);
78 void writeArray(const std::vector<int> &positions);
79 void writeArray(const std::vector<std::uint8_t> &small_uint_list);
80 void writeArray(const QStringList &str_list);
81 void writeArray(const std::vector<QString> &str_list);
82
83 /** @brief serialize a PAPPSO trace object to CBOR
84 * @param trace PAPPSO trace object reference
85 * @param x_label label for first dimension (x by default)
86 * @param y_label label for second dimension (y by default)
87 */
88 void writeTrace(const pappso::Trace &trace,
89 const QString &x_label = "x",
90 const QString &y_label = "y");
91
92
93 /** @brief serialize a PAPPSO xic coordinate object to CBOR
94 * @param xic PAPPSO object reference
95 */
96 void writeXicCoord(const pappso::XicCoord &xic_coord);
97
98 /** @brief serialize a PAPPSO xic coordinate object list to CBOR
99 * @param xic_coord_list PAPPSO object reference
100 */
101 void writeXicCoordList(const std::vector<pappso::XicCoordSPtr> &xic_coord_list);
102
103 private:
104 QString m_uuid;
105};
106} // namespace cbor
107} // namespace pappso
A simple container of DataPoint instances.
Definition trace.h:152
void writeInformations(const QString &software_name, const QString &software_version, const QString &type, const QString &operation)
automatically produces an informations CBOR map the "informations" map contains default parameters : ...
void writeXicCoord(const pappso::XicCoord &xic_coord)
serialize a PAPPSO xic coordinate object to CBOR
void writeArray(const std::vector< std::size_t > &int_list)
void writeXicCoordList(const std::vector< pappso::XicCoordSPtr > &xic_coord_list)
serialize a PAPPSO xic coordinate object list to CBOR
void writeTrace(const pappso::Trace &trace, const QString &x_label="x", const QString &y_label="y")
serialize a PAPPSO trace object to CBOR
const QString & getUuid() const
get UUID intialized when using writeInformations
void writeCborMap(const QCborMap &cbor_map)
void writeCborArray(const QCborArray &cbor_array)
#define PMSPP_LIB_DECL
tries to keep as much as possible monoisotopes, removing any possible C13 peaks and changes multichar...
Definition aa.cpp:39
coordinates of the XIC to extract and the resulting XIC after extraction
Definition xiccoord.h:68