Loading...
Searching...
No Matches
pappso::cbor::CborStreamWriter Class Reference

overrides QCborStreamWriter base class to provide convenient functions More...

`#include <cborstreamwriter.h>`

Inheritance diagram for pappso::cbor::CborStreamWriter:

## Public Member Functions

| CborStreamWriter (QByteArray *data)
| CborStreamWriter (QIODevice *device)
virtual | ~CborStreamWriter ()
const QString & | getUuid () const
| get UUID intialized when using 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 : software, versions, UUID
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)
void | writeTrace (const pappso::Trace &trace, const QString &x_label="x", const QString &y_label="y")
| serialize a PAPPSO trace object to CBOR
void | writeXicCoord (const pappso::XicCoord &xic_coord)
| serialize a PAPPSO xic coordinate object to CBOR
void | writeXicCoordList (const std::vector< pappso::XicCoordSPtr > &xic_coord_list)
| serialize a PAPPSO xic coordinate object list to CBOR

## Private Attributes

QString | m_uuid

## Detailed Description

overrides QCborStreamWriter base class to provide convenient functions

Definition at line 44 of file cborstreamwriter.h.

## Constructor & Destructor Documentation

## CborStreamWriter() [1/2]

pappso::cbor::CborStreamWriter::CborStreamWriter | ( | QByteArray * | data | ) |

Default constructor

Definition at line 38 of file cborstreamwriter.cpp.

: QCborStreamWriter(data)
{
}

## CborStreamWriter() [2/2]

pappso::cbor::CborStreamWriter::CborStreamWriter | ( | QIODevice * | device | ) |

Definition at line 42 of file cborstreamwriter.cpp.

: QCborStreamWriter(device)
{
}

## ~CborStreamWriter()

pappso::cbor::CborStreamWriter::~CborStreamWriter | ( |  | ) |

virtual

Destructor

Definition at line 47 of file cborstreamwriter.cpp.

{
}

## Member Function Documentation

## getUuid()

const QString & pappso::cbor::CborStreamWriter::getUuid | ( |  | ) | const

get UUID intialized when using writeInformations

Returns
  QString for the UUID

Definition at line 53 of file cborstreamwriter.cpp.

{
return m_uuid;
}
pappso::cbor::CborStreamWriter::m_uuid
QString m_uuid
Definition cborstreamwriter.h:104

References m_uuid.

## writeArray() [1/7]

void pappso::cbor::CborStreamWriter::writeArray | ( | const QStringList & | str_list | ) |

Definition at line 151 of file cborstreamwriter.cpp.

{
startArray(str_list.size());
for(auto str_item : str_list)
{
append(str_item);
}
endArray();
}

## writeArray() [2/7]

void pappso::cbor::CborStreamWriter::writeArray | ( | const std::vector< double > & | double_list | ) |

Definition at line 104 of file cborstreamwriter.cpp.

{
startArray(double_list.size());
for(auto num : double_list)
{
append(num);
}
endArray();
}

## writeArray() [3/7]

void pappso::cbor::CborStreamWriter::writeArray | ( | const std::vector< int > & | positions | ) |

Definition at line 115 of file cborstreamwriter.cpp.

{
startArray(positions.size());
for(auto num : positions)
{
append(num);
}
endArray();
}

## writeArray() [4/7]

void pappso::cbor::CborStreamWriter::writeArray | ( | const std::vector< qint64 > & | int_list | ) |

Definition at line 139 of file cborstreamwriter.cpp.

{
startArray(int_list.size());
for(auto num : int_list)
{
append(num);
}
endArray();
}

## writeArray() [5/7]

void pappso::cbor::CborStreamWriter::writeArray | ( | const std::vector< QString > & | str_list | ) |

Definition at line 162 of file cborstreamwriter.cpp.

{
startArray(str_list.size());
for(auto str_item : str_list)
{
append(str_item);
}
endArray();
}

## writeArray() [6/7]

void pappso::cbor::CborStreamWriter::writeArray | ( | const std::vector< std::size_t > & | int_list | ) |

Definition at line 93 of file cborstreamwriter.cpp.

{
startArray(int_list.size());
for(auto num : int_list)
{
append((quint64)num);
}
endArray();
}

Referenced by pappso::cbor::mzcbor::MzmlConvert::writeMzcborIndex(), and writeTrace().

## writeArray() [7/7]

void pappso::cbor::CborStreamWriter::writeArray | ( | const std::vector< std::uint8_t > & | small_uint_list | ) |

Definition at line 127 of file cborstreamwriter.cpp.

{
startArray(small_uint_list.size());
for(int num : small_uint_list)
{
append(num);
}
endArray();
}

## writeCborArray()

void pappso::cbor::CborStreamWriter::writeCborArray | ( | const QCborArray & | cbor_array | ) |

Definition at line 179 of file cborstreamwriter.cpp.

{
QCborValue(cbor_array).toCbor(*this);
}

## writeCborMap()

void pappso::cbor::CborStreamWriter::writeCborMap | ( | const QCborMap & | cbor_map | ) |

Definition at line 173 of file cborstreamwriter.cpp.

{
QCborValue(cbor_map).toCbor(*this);
}

Referenced by pappso::cbor::psm::PsmFileAppend::readSample(), and pappso::cbor::psm::PsmProteinMap::writeMap().

## writeInformations()

void pappso::cbor::CborStreamWriter::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 : software, versions, UUID

Definition at line 59 of file cborstreamwriter.cpp.

{
append("informations");
startMap();
append(QLatin1String("software"));
append(software_name);
append(QLatin1String("version"));
append(software_version);
append(QLatin1String("type"));
append(type);
append(QLatin1String("operation"));
append(operation);
append(QLatin1String("cpu_used"));
append(QThreadPool::globalInstance()->maxThreadCount());
append(QLatin1String("pappsomspp_version"));
append(pappso::Utils::getVersion());
append(QLatin1String("sysinfo_machine_hostname"));
append(QSysInfo::machineHostName());
append(QLatin1String("sysinfo_product_name"));
append(QSysInfo::prettyProductName());
append(QLatin1String("timestamp"));
append(QDateTime::currentDateTime().toString(Qt::ISODate));
append(QLatin1String("uuid"));
m_uuid = QUuid::createUuid().toString();
append(m_uuid);
endMap();
}
pappso::Utils::getVersion
static QString getVersion()
Definition utils.cpp:650

References pappso::Utils::getVersion(), and m_uuid.

Referenced by pappso::cbor::mzcbor::MzmlConvert::writeMzcborIndex().

## writeTrace()

void pappso::cbor::CborStreamWriter::writeTrace | ( | const pappso::Trace & | trace,
|  | const QString & | x_label = "x",
|  | const QString & | y_label = "y" )

serialize a PAPPSO trace object to CBOR

Parameters

  trace | PAPPSO trace object reference
  x_label | label for first dimension (x by default)
  y_label | label for second dimension (y by default)

Definition at line 185 of file cborstreamwriter.cpp.

{
startMap(2);
append(x_label);
writeArray(trace.xValues());
append(y_label);
writeArray(trace.yValues());
endMap();
}
pappso::Trace::xValues
std::vector< pappso_double > xValues() const
Definition trace.cpp:697
pappso::Trace::yValues
std::vector< pappso_double > yValues() const
Definition trace.cpp:711
pappso::cbor::CborStreamWriter::writeArray
void writeArray(const std::vector< std::size_t > &int_list)
Definition cborstreamwriter.cpp:93

References writeArray(), pappso::Trace::xValues(), and pappso::Trace::yValues().

Referenced by writeXicCoord().

## writeXicCoord()

void pappso::cbor::CborStreamWriter::writeXicCoord | ( | const pappso::XicCoord & | xic_coord | ) |

serialize a PAPPSO xic coordinate object to CBOR

Parameters

  xic | PAPPSO object reference

Definition at line 199 of file cborstreamwriter.cpp.

{
startMap();
xic_coord.writeCborStream(*this);
if(xic_coord.xicSptr.get() != nullptr)
{
append("xic");
writeTrace(*xic_coord.xicSptr.get(), "rt", "intensities");
}
endMap();
}
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::XicCoord::xicSptr
XicSPtr xicSptr
extracted xic
Definition xiccoord.h:135
pappso::XicCoord::writeCborStream
virtual void writeCborStream(QCborStreamWriter &cbor_writer) const
writes xic coordinates in a cbor stream
Definition xiccoord.cpp:127

References pappso::XicCoord::writeCborStream(), writeTrace(), and pappso::XicCoord::xicSptr.

Referenced by writeXicCoordList().

## writeXicCoordList()

void pappso::cbor::CborStreamWriter::writeXicCoordList | ( | const std::vector< pappso::XicCoordSPtr > & | xic_coord_list | ) |

serialize a PAPPSO xic coordinate object list to CBOR

Parameters

  xic_coord_list | PAPPSO object reference

Definition at line 214 of file cborstreamwriter.cpp.

{
startArray(xic_coord_list.size());
for(auto &xic_coord_sp : xic_coord_list)
{
writeXicCoord(*xic_coord_sp.get());
}
endArray();
}
pappso::cbor::CborStreamWriter::writeXicCoord
void writeXicCoord(const pappso::XicCoord &xic_coord)
serialize a PAPPSO xic coordinate object to CBOR
Definition cborstreamwriter.cpp:199

References writeXicCoord().

## Member Data Documentation

## m_uuid

QString pappso::cbor::CborStreamWriter::m_uuid

private

Definition at line 104 of file cborstreamwriter.h.

Referenced by getUuid(), and writeInformations().

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

- pappsomspp/core/processing/cbor/cborstreamwriter.h
- pappsomspp/core/processing/cbor/cborstreamwriter.cpp