16 #include "Device/IO/ReadReflectometry.h"
25 return "Legacy from BornAgain 1.18";
30 return "AutomaticDataLoader1D";
43 QDataStream s(&a, QIODevice::WriteOnly);
44 s.setVersion(QDataStream::Qt_5_12);
59 s.setVersion(QDataStream::Qt_5_12);
70 if (s.status() != QDataStream::Ok)
91 auto* oData = ReadReflectometry().readDatafield(str);
96 }
catch (std::runtime_error& ex) {
99 m_error = QString::fromStdString(ex.what());
114 return m_error.isEmpty() ? 0 : 1;
Defines class AutomaticDataLoader1DResultModel.
Defines class AutomaticDataLoader1D.
Defines class DeserializationException.
Defines ImportDataInfo helper struct.
Defines class RealDataItem.
Defines class SpecularDataItem.
Base class for result tables of data loaders. Derive from this class and return an instance in YourDa...
Abstract base class for all data loaders (classes to import real data).
void contentsProcessed()
Emitted whenever contents have been processed.
RealDataItem * m_item
The real-data-item which owns this loader. Never delete this!
The result model of a AutomaticDataLoader1D (for showing the import results in a table view).
The legacy importer for reflectometry, with no user interaction.
QString persistentClassName() const override
A name which can be used for save/load purposes (which will not change ever more)
void processContents() override
Process the file contents. Can be called more than once, e.g. if the import settings have changed....
void deserialize(const QByteArray &data) override
Initialize from serialization data. If any error occurred, then a DeserializationException has to be ...
int numErrors() const override
Number of errors found while processing the content. An error means that either a particular content ...
AbstractDataLoader * clone() const override
Create a complete clone, including all internal states.
QByteArray serialize() const override
Returns every internal setting so it can be restored completely.
QString name() const override
The name shown in the format selection combo.
AbstractDataLoaderResultModel * createResultModel() const override
Create a table model which contains the import information like original file content,...
QStringList lineUnrelatedErrors() const override
Errors not related to a particular line.
QByteArray fileContent() const override
Returns the original file content. If not available any more (like for legacy project file import),...
void setFileContents(const QByteArray &fileContent) override
Sets the file contents to be imported. If the file was a compressed file, then the decompressed conte...
static DeserializationException streamError()
static DeserializationException tooNew()
Carries information about loaded data.
bool isSpecularData() const
void setImportData(ImportDataInfo info)
Sets imported data to underlying item. Creates it if not existing. This is used for 1D import....
SpecularDataItem * specularDataItem()
void setDatafield(Datafield *data) override
The given pointer becomes owned by this class!!