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

base class to start a CBOR reader More...

`#include <cborstreamreaderinterface.h>`

Inheritance diagram for pappso::cbor::CborStreamReaderInterface:

## Public Member Functions

| CborStreamReaderInterface ()
virtual | ~CborStreamReaderInterface ()
virtual void | close ()
| convenient function to clean pointer before leaving

## Protected Member Functions

bool | getExpectedString ()
void | initCborReader (QFile *pcborfile)
void | initCborReader (QIODevice *pcborfile)

## Protected Attributes

CborStreamReader * | mpa_cborReader = nullptr
QString | m_expectedString
QByteArray | m_data

## Detailed Description

base class to start a CBOR reader

containing convenient function to ensure that the stream pointer to the CBOR source (file or device) is correctly open.

Definition at line 42 of file cborstreamreaderinterface.h.

## Constructor & Destructor Documentation

## CborStreamReaderInterface()

pappso::cbor::CborStreamReaderInterface::CborStreamReaderInterface | ( |  | ) |

Default constructor

Definition at line 30 of file cborstreamreaderinterface.cpp.

{
}

Referenced by pappso::cbor::psm::PsmFileReaderBase::PsmFileReaderBase().

## ~CborStreamReaderInterface()

pappso::cbor::CborStreamReaderInterface::~CborStreamReaderInterface | ( |  | ) |

virtual

Destructor

Definition at line 34 of file cborstreamreaderinterface.cpp.

{
// qWarning() << "~CborStreamReaderInterface";
if(mpa_cborReader != nullptr)
delete mpa_cborReader;
mpa_cborReader = nullptr;
}
pappso::cbor::CborStreamReaderInterface::mpa_cborReader
CborStreamReader * mpa_cborReader
Definition cborstreamreaderinterface.h:68

References mpa_cborReader.

## Member Function Documentation

## close()

void pappso::cbor::CborStreamReaderInterface::close | ( |  | ) |

virtual

convenient function to clean pointer before leaving

Reimplemented in pappso::cbor::mzcbor::ConvertToMzml, pappso::cbor::mzcbor::MzcborIndexReader, pappso::cbor::mzcbor::MzcborReaderBase, pappso::cbor::psm::PsmCbor2Json, pappso::cbor::psm::PsmFileAppend, and pappso::cbor::psm::PsmFileScanProcessAndCopy.

Definition at line 44 of file cborstreamreaderinterface.cpp.

{
// qWarning() << "close PsmFileReaderBase";
if(mpa_cborReader != nullptr)
delete mpa_cborReader;
mpa_cborReader = nullptr;
// qWarning() << "close PsmFileReaderBase";
}

References mpa_cborReader.

## getExpectedString()

bool pappso::cbor::CborStreamReaderInterface::getExpectedString | ( |  | ) |

protected

Definition at line 54 of file cborstreamreaderinterface.cpp.

{
bool is_ok = false;
m_expectedString = "";
qDebug() << mpa_cborReader->type();
if(mpa_cborReader->type() == QCborStreamReader::String)
{
is_ok = mpa_cborReader->decodeString(m_expectedString);
}
return is_ok;
}
pappso::cbor::CborStreamReaderInterface::m_expectedString
QString m_expectedString
Definition cborstreamreaderinterface.h:69

References m_expectedString, and mpa_cborReader.

Referenced by pappso::cbor::mzcbor::MzcborBuildIndexReader::readMsrun(), pappso::cbor::mzcbor::MzcborReaderBase::readMsrun(), pappso::cbor::mzcbor::MzcborSpectrumCollectionReader::readMsrun(), pappso::cbor::psm::PsmFileReaderBase::readPsm(), pappso::cbor::psm::PsmFileReaderBase::readPsmFile(), pappso::cbor::psm::PsmFileReaderBase::readPsmProteinRef(), pappso::cbor::mzcbor::MzcborReaderBase::readReferenceableParamGroupList(), pappso::cbor::mzcbor::ConvertToMzml::readRoot(), pappso::cbor::mzcbor::MzcborIndexReader::readRoot(), pappso::cbor::mzcbor::MzcborReaderBase::readRoot(), pappso::cbor::psm::PsmFileReaderBase::readRoot(), pappso::cbor::psm::PsmFileReaderBase::readSample(), pappso::cbor::mzcbor::MzcborSpectrumCollectionReader::readScan(), pappso::cbor::psm::PsmFileReaderBase::readScan(), pappso::cbor::mzcbor::MzcborBuildIndexReader::readSpectrum(), pappso::cbor::mzcbor::MzcborBuildIndexReader::readSpectrumListAndLeave(), pappso::cbor::mzcbor::MzcborSpectrumCollectionReader::readSpectrumListAndLeave(), and pappso::cbor::mzcbor::ConvertToMzml::writeElementInMzml().

## initCborReader() [1/2]

void pappso::cbor::CborStreamReaderInterface::initCborReader | ( | QFile * | pcborfile | ) |

protected

Definition at line 80 of file cborstreamreaderinterface.cpp.

{
if(mpa_cborReader != nullptr)
delete mpa_cborReader;
mpa_cborReader = nullptr;
mpa_cborReader = new CborStreamReader();
// try to mmap the file, this is faster
char *ptr =
reinterpret_cast<char *>(pcborfile->map(0, pcborfile->size(), QFile::MapPrivateOption));
if(ptr)
{
// worked
m_data = QByteArray::fromRawData(ptr, pcborfile->size());
mpa_cborReader->addData(m_data);
}
else if(pcborfile->isSequential())
{
// details requires full contents, so allocate memory
m_data = pcborfile->readAll();
mpa_cborReader->addData(m_data);
}
else
{
// just use the QIODevice
mpa_cborReader->setDevice(pcborfile);
}
}
pappso::cbor::CborStreamReaderInterface::m_data
QByteArray m_data
Definition cborstreamreaderinterface.h:70

References m_data, and mpa_cborReader.

Referenced by pappso::cbor::mzcbor::ConvertToMzml::readCbor(), pappso::cbor::mzcbor::ConvertToMzml::readCbor(), pappso::cbor::mzcbor::MzcborBuildIndexReader::readCbor(), pappso::cbor::mzcbor::MzcborIndexReader::readCbor(), pappso::cbor::mzcbor::MzcborReaderBase::readCbor(), pappso::cbor::mzcbor::MzcborReaderBase::readCbor(), pappso::cbor::psm::PsmFileReaderBase::readCbor(), and pappso::cbor::psm::PsmFileReaderBase::readCbor().

## initCborReader() [2/2]

void pappso::cbor::CborStreamReaderInterface::initCborReader | ( | QIODevice * | pcborfile | ) |

protected

Definition at line 69 of file cborstreamreaderinterface.cpp.

{
if(mpa_cborReader != nullptr)
delete mpa_cborReader;
mpa_cborReader = nullptr;
mpa_cborReader = new CborStreamReader();
// just use the QIODevice
mpa_cborReader->setDevice(pcborfile);
}

References mpa_cborReader.

## Member Data Documentation

## m_data

QByteArray pappso::cbor::CborStreamReaderInterface::m_data

protected

Definition at line 70 of file cborstreamreaderinterface.h.

Referenced by initCborReader().

## m_expectedString

QString pappso::cbor::CborStreamReaderInterface::m_expectedString

protected

Definition at line 69 of file cborstreamreaderinterface.h.

Referenced by getExpectedString(), pappso::cbor::mzcbor::MzcborBuildIndexReader::readMsrun(), pappso::cbor::mzcbor::MzcborReaderBase::readMsrun(), pappso::cbor::mzcbor::MzcborSpectrumCollectionReader::readMsrun(), pappso::cbor::psm::PsmFileReaderBase::readPsm(), pappso::cbor::psm::PsmFileReaderBase::readPsmFile(), pappso::cbor::psm::PsmFileReaderBase::readPsmProteinRef(), pappso::cbor::mzcbor::MzcborReaderBase::readReferenceableParamGroupList(), pappso::cbor::mzcbor::ConvertToMzml::readRoot(), pappso::cbor::mzcbor::MzcborIndexReader::readRoot(), pappso::cbor::mzcbor::MzcborReaderBase::readRoot(), pappso::cbor::psm::PsmFileReaderBase::readRoot(), pappso::cbor::psm::PsmFileReaderBase::readSample(), pappso::cbor::mzcbor::MzcborSpectrumCollectionReader::readScan(), pappso::cbor::psm::PsmFileReaderBase::readScan(), pappso::cbor::mzcbor::MzcborBuildIndexReader::readSpectrum(), pappso::cbor::mzcbor::MzcborBuildIndexReader::readSpectrumListAndLeave(), pappso::cbor::mzcbor::MzcborSpectrumCollectionReader::readSpectrumListAndLeave(), and pappso::cbor::mzcbor::ConvertToMzml::writeElementInMzml().

## mpa_cborReader

CborStreamReader* pappso::cbor::CborStreamReaderInterface::mpa_cborReader = nullptr

protected

Definition at line 68 of file cborstreamreaderinterface.h.

Referenced by ~CborStreamReaderInterface(), close(), pappso::cbor::mzcbor::MzcborReaderBase::getCvParamsMap(), getExpectedString(), initCborReader(), initCborReader(), pappso::cbor::mzcbor::ConvertToMzml::readCbor(), pappso::cbor::mzcbor::ConvertToMzml::readCbor(), pappso::cbor::mzcbor::MzcborBuildIndexReader::readCbor(), pappso::cbor::mzcbor::MzcborIndexReader::readCbor(), pappso::cbor::mzcbor::MzcborReaderBase::readCbor(), pappso::cbor::mzcbor::MzcborReaderBase::readCbor(), pappso::cbor::psm::PsmFileReaderBase::readCbor(), pappso::cbor::psm::PsmFileReaderBase::readCbor(), pappso::cbor::psm::PsmFileReaderBase::readInformations(), pappso::cbor::psm::PsmFileReaderBase::readLog(), pappso::cbor::mzcbor::MzcborBuildIndexReader::readMsrun(), pappso::cbor::mzcbor::MzcborReaderBase::readMsrun(), pappso::cbor::mzcbor::MzcborSpectrumCollectionReader::readMsrun(), pappso::cbor::psm::PsmFileReaderBase::readParameterMap(), pappso::cbor::psm::PsmCbor2Json::readProteinMap(), pappso::cbor::psm::PsmFileReaderBase::readProteinMap(), pappso::cbor::psm::PsmFileReaderBase::readPsm(), pappso::cbor::psm::PsmFileReaderBase::readPsmFile(), pappso::cbor::psm::PsmFileReaderBase::readPsmProteinRef(), pappso::cbor::mzcbor::MzcborReaderBase::readReferenceableParamGroupList(), pappso::cbor::mzcbor::ConvertToMzml::readRoot(), pappso::cbor::mzcbor::MzcborIndexReader::readRoot(), pappso::cbor::mzcbor::MzcborReaderBase::readRoot(), pappso::cbor::psm::PsmFileReaderBase::readRoot(), pappso::cbor::psm::PsmFileAppend::readSample(), pappso::cbor::psm::PsmFileReaderBase::readSample(), pappso::cbor::mzcbor::MzcborSpectrumCollectionReader::readScan(), pappso::cbor::psm::PsmFileReaderBase::readScan(), pappso::cbor::psm::PsmFileScanProcess::readScan(), pappso::cbor::mzcbor::MzcborBuildIndexReader::readSpectrum(), pappso::cbor::mzcbor::MzcborSpectrumCollectionReader::readSpectrum(), pappso::cbor::mzcbor::MzcborBuildIndexReader::readSpectrumListAndLeave(), pappso::cbor::mzcbor::MzcborSpectrumCollectionReader::readSpectrumListAndLeave(), and pappso::cbor::mzcbor::ConvertToMzml::writeElementInMzml().

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

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