32 #include "../../trace/datapoint.h"
33 #include "../../pappsoexception.h"
34 #include "../../exception/exceptionoutofrange.h"
57 return std::make_shared<const MsRunSlice>(*
this);
97 catch(std::exception &error)
99 qDebug() << __FILE__ <<
" " << __FUNCTION__ <<
" " << __LINE__;
101 QObject::tr(
"unable to access spectrum %1 (size=%2) %3")
115 catch(std::exception &error)
117 qDebug() << __FILE__ <<
" " << __FUNCTION__ <<
" " << __LINE__;
119 QObject::tr(
"unable to get spectrum %1 (size=%2) %3")
132 catch(std::exception &error)
134 qDebug() << __FILE__ <<
" " << __FUNCTION__ <<
" " << __LINE__;
136 QObject::tr(
"unable to get spectrum %1 (size=%2) %3")
149 outstream << (quint32)ipos;
150 outstream << spectrum;
156 operator>>(QDataStream &instream, MsRunSlice &slice)
160 quint32 slice_number;
161 quint32 spectrum_position = 0;
164 if(!instream.atEnd())
166 instream >> slice_number;
167 instream >> vector_size;
168 qDebug() << __FILE__ <<
" " << __FUNCTION__ <<
" " << __LINE__
169 <<
" vector_size=" << vector_size;
170 slice.setSize(vector_size);
172 slice.setSliceNumber(slice_number);
173 while(!instream.atEnd())
175 instream >> spectrum_position;
179 instream >> spectrum;
181 catch(PappsoException &error)
183 throw PappsoException(
184 QString(
"error in QDataStream unserialize operator>> of "
185 "MsRunSlice %2 on %3:\n%1")
187 .arg(spectrum_position)
190 slice.setSpectrum(spectrum_position, spectrum);
192 if(instream.status() != QDataStream::Ok)
194 throw PappsoException(
195 QString(
"error in QDataStream unserialize operator>> of "
196 "MsRunSlice :\nread datastream failed status=%1")
197 .arg(instream.status()));
202 if(slice.size() != vector_size)
204 throw PappsoException(
205 QString(
"error in QDataStream unserialize operator>> of MsRunSlice "
206 "slice.size() != vector_size :\n %1 %2:")