Loading...
Searching...
No Matches
cborstreamwriter.h
Go to the documentation of this file.
/**
* \file pappsomspp/processing/cbor/cborstreamwriter.h
* \date 05/07/2025
* \author Olivier Langella
* \brief PAPPSO CBOR stream writer
*/
/*******************************************************************************
* Copyright (c) 2025 Olivier Langella <Olivier.Langella@universite-paris-saclay.fr>.
*
* This file is part of PAPPSOms-tools.
*
* PAPPSOms-tools is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* PAPPSOms-tools is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with PAPPSOms-tools. If not, see <http://www.gnu.org/licenses/>.
*
******************************************************************************/
#pragma once
#include <QCborStreamWriter>
#include <QCborMap>
#include "pappsomspp/core/msrun/xiccoord/xiccoord.h"
#include "pappsomspp/export-import-config.h"
#include "pappsomspp/core/trace/trace.h"
namespace pappso
{
namespace cbor
{
/** @brief overrides QCborStreamWriter base class to provide convenient functions
*/
class PMSPP_LIB_DECL CborStreamWriter : public QCborStreamWriter
{
public:
/**
* Default constructor
*/
CborStreamWriter(QByteArray *data);
CborStreamWriter(QIODevice *device);
/**
* Destructor
*/
virtual ~CborStreamWriter();
/** @brief get UUID intialized when using @ref writeInformations
* @return QString for the UUID
*/
const QString &getUuid() const;
/** @brief automatically produces an informations CBOR map
* the "informations" map contains default parameters : software, versions, UUID
*/
void writeInformations(const QString &software_name,
const QString &software_version,
const QString &type,
const QString &operation);
void writeCborMap(const QCborMap &cbor_map);
void writeCborArray(const QCborArray &cbor_array);
void writeArray(const std::vector<std::size_t> &int_list);
void writeArray(const std::vector<qint64> &int_list);
void writeArray(const std::vector<double> &double_list);
void writeArray(const std::vector<int> &positions);
void writeArray(const std::vector<std::uint8_t> &small_uint_list);
void writeArray(const QStringList &str_list);
void writeArray(const std::vector<QString> &str_list);
/** @brief serialize a PAPPSO trace object to CBOR
* @param trace PAPPSO trace object reference
* @param x_label label for first dimension (x by default)
* @param y_label label for second dimension (y by default)
*/
void writeTrace(const pappso::Trace &trace,
const QString &x_label = "x",
const QString &y_label = "y");
/** @brief serialize a PAPPSO xic coordinate object to CBOR
* @param xic PAPPSO object reference
*/
void writeXicCoord(const pappso::XicCoord &xic_coord);
/** @brief serialize a PAPPSO xic coordinate object list to CBOR
* @param xic_coord_list PAPPSO object reference
*/
void writeXicCoordList(const std::vector<pappso::XicCoordSPtr> &xic_coord_list);
private:
QString m_uuid;
};
} // namespace cbor
} // namespace pappso
pappso::Trace
A simple container of DataPoint instances.
Definition trace.h:152
pappso::cbor::CborStreamWriter::CborStreamWriter
CborStreamWriter(QByteArray *data)
Definition cborstreamwriter.cpp:38
pappso::cbor::CborStreamWriter::writeInformations
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 : ...
Definition cborstreamwriter.cpp:59
pappso::cbor::CborStreamWriter::writeXicCoord
void writeXicCoord(const pappso::XicCoord &xic_coord)
serialize a PAPPSO xic coordinate object to CBOR
Definition cborstreamwriter.cpp:199
pappso::cbor::CborStreamWriter::writeArray
void writeArray(const std::vector< std::size_t > &int_list)
Definition cborstreamwriter.cpp:93
pappso::cbor::CborStreamWriter::writeXicCoordList
void writeXicCoordList(const std::vector< pappso::XicCoordSPtr > &xic_coord_list)
serialize a PAPPSO xic coordinate object list to CBOR
Definition cborstreamwriter.cpp:214
pappso::cbor::CborStreamWriter::writeTrace
void writeTrace(const pappso::Trace &trace, const QString &x_label="x", const QString &y_label="y")
serialize a PAPPSO trace object to CBOR
Definition cborstreamwriter.cpp:185
pappso::cbor::CborStreamWriter::getUuid
const QString & getUuid() const
get UUID intialized when using writeInformations
Definition cborstreamwriter.cpp:53
pappso::cbor::CborStreamWriter::writeCborMap
void writeCborMap(const QCborMap &cbor_map)
Definition cborstreamwriter.cpp:173
pappso::cbor::CborStreamWriter::writeCborArray
void writeCborArray(const QCborArray &cbor_array)
Definition cborstreamwriter.cpp:179
pappso::cbor::CborStreamWriter::m_uuid
QString m_uuid
Definition cborstreamwriter.h:104
export-import-config.h
PMSPP_LIB_DECL
#define PMSPP_LIB_DECL
Definition export-import-config.h:14
pappso::cbor
Definition cborstreamreader.cpp:35
pappso
tries to keep as much as possible monoisotopes, removing any possible C13 peaks and changes multichar...
Definition aa.cpp:39
pappso::XicCoord
coordinates of the XIC to extract and the resulting XIC after extraction
Definition xiccoord.h:68
trace.h
xiccoord.h