Loading...
Searching...
No Matches
pappso::TimsFrameRawDataChunck Class Reference

`#include <timsframerawdatachunck.h>`

## Public Member Functions

| TimsFrameRawDataChunck ()
virtual | ~TimsFrameRawDataChunck ()
bool | readTimsFrame (QFile *p_file, std::size_t frameId, const std::vector< pappso::TimsFrameRecord > &frame_record_list)
quint32 | getFrameNumberOfScans () const
quint32 | getCompressedSize () const
quint32 | getFrameLength () const
char * | getMemoryBuffer () const
std::size_t | getFrameId () const

## Private Attributes

char * | mpa_memoryBuffer = nullptr
qint64 | m_memoryBufferSize = 0
std::size_t | m_frameId = 0
quint32 | m_frameLength = 0
quint32 | m_frameNumberOfScans = 0

## Detailed Description

Todo
  write docs

Definition at line 40 of file timsframerawdatachunck.h.

## Constructor & Destructor Documentation

## TimsFrameRawDataChunck()

TimsFrameRawDataChunck::TimsFrameRawDataChunck | ( |  | ) |

Default constructor

Definition at line 36 of file timsframerawdatachunck.cpp.

{
}

## ~TimsFrameRawDataChunck()

TimsFrameRawDataChunck::~TimsFrameRawDataChunck | ( |  | ) |

virtual

Destructor

Definition at line 40 of file timsframerawdatachunck.cpp.

{
if(mpa_memoryBuffer != nullptr)
delete[] mpa_memoryBuffer;
}
pappso::TimsFrameRawDataChunck::mpa_memoryBuffer
char * mpa_memoryBuffer
Definition timsframerawdatachunck.h:67

References mpa_memoryBuffer.

## Member Function Documentation

## getCompressedSize()

quint32 pappso::TimsFrameRawDataChunck::getCompressedSize | ( |  | ) | const

Definition at line 186 of file timsframerawdatachunck.cpp.

{
return m_frameLength - 8;
}
pappso::TimsFrameRawDataChunck::m_frameLength
quint32 m_frameLength
Definition timsframerawdatachunck.h:71

References m_frameLength.

Referenced by pappso::TimsBinDec::getTimsFrameFromRawDataChunck().

## getFrameId()

std::size_t pappso::TimsFrameRawDataChunck::getFrameId | ( |  | ) | const

Definition at line 204 of file timsframerawdatachunck.cpp.

{
return m_frameId;
}
pappso::TimsFrameRawDataChunck::m_frameId
std::size_t m_frameId
Definition timsframerawdatachunck.h:70

References m_frameId.

Referenced by pappso::TimsBinDec::getTimsFrameFromRawDataChunck().

## getFrameLength()

quint32 pappso::TimsFrameRawDataChunck::getFrameLength | ( |  | ) | const

Definition at line 198 of file timsframerawdatachunck.cpp.

{
return m_frameLength;
}

References m_frameLength.

Referenced by pappso::TimsBinDec::getTimsFrameFromRawDataChunck().

## getFrameNumberOfScans()

quint32 pappso::TimsFrameRawDataChunck::getFrameNumberOfScans | ( |  | ) | const

Definition at line 192 of file timsframerawdatachunck.cpp.

{
return m_frameNumberOfScans;
}
pappso::TimsFrameRawDataChunck::m_frameNumberOfScans
quint32 m_frameNumberOfScans
Definition timsframerawdatachunck.h:72

References m_frameNumberOfScans.

Referenced by pappso::TimsBinDec::getTimsFrameFromRawDataChunck().

## getMemoryBuffer()

char * pappso::TimsFrameRawDataChunck::getMemoryBuffer | ( |  | ) | const

Definition at line 180 of file timsframerawdatachunck.cpp.

{
return mpa_memoryBuffer;
}

References mpa_memoryBuffer.

Referenced by pappso::TimsBinDec::getTimsFrameFromRawDataChunck().

## readTimsFrame()

bool TimsFrameRawDataChunck::readTimsFrame | ( | QFile * | p_file,
|  | std::size_t | frameId,
|  | const std::vector< pappso::TimsFrameRecord > & | frame_record_list )

Definition at line 47 of file timsframerawdatachunck.cpp.

{
m_frameId = frameId;
qint64 position = p_file->pos();
const pappso::TimsFrameRecord &frame_record = frame_record_list[frameId];
if(frameId == 1)
{
bool seekpos_ok = p_file->seek(frame_record.tims_offset);
if(!seekpos_ok)
{
throw PappsoException(QObject::tr("ERROR reading TIMS frame %1 "
"m_timsBinFile.seek(%3) failed")
.arg(frameId)
.arg(frame_record.tims_offset));
}
}
else
{
if(position == (qint64)frame_record.tims_offset)
{
// OK
}
else
{
// need to move to frame position :
if(position > (qint64)frame_record.tims_offset)
{
// get back
p_file->seek(frame_record.tims_offset);
position = p_file->pos();
}
else
{
const pappso::TimsFrameRecord &previous_frame_record = frame_record_list[frameId - 1];
if(position < (qint64)previous_frame_record.tims_offset)
{
throw PappsoException(QObject::tr("ERROR reading TIMS frame %1 "
"file position %2 is before previous frame %3")
.arg(frameId)
.arg(position)
.arg(previous_frame_record.tims_offset));
}
else
{
// catch up current position
qint64 move_size = (qint64)frame_record.tims_offset - position;
p_file->read(move_size);
position = p_file->pos();
}
}
}
}
if(position != (qint64)frame_record.tims_offset)
{
throw PappsoException(QObject::tr("ERROR reading TIMS frame %1 "
"file position %2 is different of frame offset %3")
.arg(frameId)
.arg(position)
.arg(frame_record.tims_offset));
}
// qDebug();
p_file->read((char *)&m_frameLength, 4);
// frame_length = qToBigEndian(frame_length);
// qDebug() << __FILE__ << " " << __FUNCTION__ << " " << __LINE__
// << " frame_length=" << frame_length;
// qDebug();
p_file->read((char *)&m_frameNumberOfScans, 4);
// scan_number = qToBigEndian(scan_number);
// qDebug() << __FILE__ << " " << __FUNCTION__ << " " << __LINE__
// << " pos=" << m_timsBinFile.pos();
// qDebug() << __FILE__ << " " << __FUNCTION__ << " " << __LINE__
// << " scan_number=" << scan_number;
// m_timsBinFile.seek(m_indexArray.at(timsId) + 8);
// qDebug();
// if (m_memoryBufferSize
if(mpa_memoryBuffer == nullptr)
{
qDebug() << "mpa_memoryBuffer == nullptr";
m_memoryBufferSize = (qint64)m_frameLength + 10;
mpa_memoryBuffer = new char[m_memoryBufferSize];
}
if((m_memoryBufferSize - 10) < m_frameLength)
{
if(mpa_memoryBuffer != nullptr)
{
delete[] mpa_memoryBuffer;
}
m_memoryBufferSize = (qint64)m_frameLength + 10;
mpa_memoryBuffer = new char[m_memoryBufferSize];
}
// QByteArray frame_byte_array(mpa_memoryBuffer, m_memoryBufferSize);
// qDebug();
qint64 read_length = p_file->read(mpa_memoryBuffer, (qint64)m_frameLength - 8);
// qDebug();
// qDebug() << __FILE__ << " " << __FUNCTION__ << " " << __LINE__
// << " +frame_length-1="
// << (quint8) * (frame_byte_array.constData() + frame_length - 1);
// qDebug() << __FILE__ << " " << __FUNCTION__ << " " << __LINE__
// << " +frame_length="
// << (quint8) * (frame_byte_array.constData() + frame_length);
// m_timsBinFile.seek(m_indexArray.at(timsId) + 8);
if(read_length + 8 != (qint64)m_frameLength)
{
throw PappsoException(QObject::tr("ERROR reading TIMS frame %1: "
"read_length=%2 != %3frame_length")
.arg(frameId)
.arg(read_length)
.arg(m_frameLength));
}
return true;
}
pappso::TimsFrameRawDataChunck::m_memoryBufferSize
qint64 m_memoryBufferSize
Definition timsframerawdatachunck.h:68
pappso::TimsFrameRecord::tims_offset
std::size_t tims_offset
Definition timsframerecord.h:37

References m_frameId, m_frameLength, m_frameNumberOfScans, m_memoryBufferSize, mpa_memoryBuffer, and pappso::TimsFrameRecord::tims_offset.

## Member Data Documentation

## m_frameId

std::size_t pappso::TimsFrameRawDataChunck::m_frameId = 0

private

Definition at line 70 of file timsframerawdatachunck.h.

Referenced by getFrameId(), and readTimsFrame().

## m_frameLength

quint32 pappso::TimsFrameRawDataChunck::m_frameLength = 0

private

Definition at line 71 of file timsframerawdatachunck.h.

Referenced by getCompressedSize(), getFrameLength(), and readTimsFrame().

## m_frameNumberOfScans

quint32 pappso::TimsFrameRawDataChunck::m_frameNumberOfScans = 0

private

Definition at line 72 of file timsframerawdatachunck.h.

Referenced by getFrameNumberOfScans(), and readTimsFrame().

## m_memoryBufferSize

qint64 pappso::TimsFrameRawDataChunck::m_memoryBufferSize = 0

private

Definition at line 68 of file timsframerawdatachunck.h.

Referenced by readTimsFrame().

## mpa_memoryBuffer

char* pappso::TimsFrameRawDataChunck::mpa_memoryBuffer = nullptr

private

Definition at line 67 of file timsframerawdatachunck.h.

Referenced by ~TimsFrameRawDataChunck(), getMemoryBuffer(), and readTimsFrame().

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

- pappsomspp/core/vendors/tims/timsframerawdatachunck.h
- pappsomspp/core/vendors/tims/timsframerawdatachunck.cpp