dataservice/datarequest.cpp

22 lines
906 B
C++

#include "datarequest.h"
DataRequest::DataRequest(const std::string &requestId, const nix::DataArray &array, DataBuffer *buf, const ArrayInfo &info, qreal start, qreal end)
: id(requestId), array(array), buffer(buf), info(info)
{
if (info.dataExtent.size() > 1) {
valid = false;
return;
}
if (info.dimType == nix::DimensionType::Sample) {
size_t s = nix::check::fits_in_size_t(start / info.sampleinterval, "Index does not fit in size_t on this system!!!");
size_t e = nix::check::fits_in_size_t((end - start)/ info.sampleinterval, "Index does not fit in size_t on this system!!!");
offset = nix::NDSize(1, s);
count = nix::NDSize(1, e);
if (offset + count > info.dataExtent)
count = info.dataExtent - offset;
}
std::cerr << "create new request " << info.arrayid << " " << offset << " " << count << std::endl;
}