BornAgain
1.19.79
Simulate and fit neutron and x-ray scattering at grazing incidence
|
Abstract base class for all data loaders (classes to import real data).
Definition at line 30 of file AbstractDataLoader.h.
Signals | |
void | contentsProcessed () |
Emitted whenever contents have been processed. More... | |
void | importSettingsChanged () |
Emitted whenever an import setting changed. More... | |
Public Member Functions | |
~AbstractDataLoader () override=default | |
virtual void | applyImportSettings () |
Read all values from the properties UI into the internal variables. More... | |
virtual AbstractDataLoader * | clone () const =0 |
Create a complete clone, including all internal states. More... | |
virtual AbstractDataLoaderResultModel * | createResultModel () const |
Create a table model which contains the import information like original file content, raw content, processed content. The returned pointer will be owned by the caller. This base class' implementation does nothing (return nullptr). More... | |
virtual QByteArray | defaultImportSettings () const |
Return the default import settings. More... | |
virtual void | deserialize (const QByteArray &data) |
Initialize from serialization data. If any error occurred, then a DeserializationException has to be thrown. The complete state has to be restored. Therefore if e.g. errors occurred in the former serialization, but errors are not serialized, then they have to be regenerated/ recalculated in here. More... | |
virtual QByteArray | fileContent () const |
Returns the original file content. If not available any more (like for legacy project file import), then an empty array will be returned. More... | |
virtual void | guessSettings () |
Guess appropriate settings (for example the separator in a CSV file). Is called only once, directly after setting the file content. More... | |
virtual void | initWithDefaultImportSettings () |
Set import settings to defaults. More... | |
virtual QStringList | lineUnrelatedErrors () const |
Errors not related to a particular line. More... | |
virtual QString | name () const =0 |
The name shown in the format selection combo. More... | |
virtual int | numErrors () const |
Number of errors found while processing the content. An error means that either a particular content (line) can't be used or may be suspicious (line related error), or that the whole content can't be used (e.g. only 1 line present). More... | |
virtual int | numLineRelatedErrors () const |
Number of errors related to a specific line. Such an error means that a particular content (line) can't be used or may be suspicious. More... | |
virtual QString | persistentClassName () const =0 |
A name which can be used for save/load purposes (which will not change ever more) More... | |
virtual void | populateImportSettingsWidget (QWidget *parent) |
Fills the widget on the import dialog pane. The implementation here in the base class does nothing (meaning "no editable properties"). More... | |
virtual void | processContents ()=0 |
Process the file contents. Can be called more than once, e.g. if the import settings have changed. Any error has to be stored in the loader (see numErrors()). More... | |
RealDataItem * | realDataItem () |
The real data item on which the import shall work. More... | |
const RealDataItem * | realDataItem () const |
The real data item on which the import shall work. More... | |
virtual QByteArray | serialize () const |
Returns every internal setting so it can be restored completely. More... | |
virtual void | setFileContents (const QByteArray &fileContent)=0 |
Sets the file contents to be imported. If the file was a compressed file, then the decompressed content will be handed over already here. More... | |
void | setRealDataItem (RealDataItem *item) |
Define the real data item on which the import shall work. More... | |
Protected Attributes | |
RealDataItem * | m_item |
The real-data-item which owns this loader. Never delete this! More... | |
|
overridedefault |
|
virtual |
Read all values from the properties UI into the internal variables.
Reimplemented in QREDataLoader.
Definition at line 20 of file AbstractDataLoader.cpp.
Referenced by cloneAsUserDefinedLoader(), and SpecularDataImportWidget::onPropertiesChanged().
|
pure virtual |
Create a complete clone, including all internal states.
Implemented in UserDefinedDataLoader1D, QREDataLoader, and AutomaticDataLoader1D.
Referenced by UserDefinedDataLoader1D::clone(), cloneAsUserDefinedLoader(), defaultImportSettings(), GUI::View::ImportDataUtils::Import1dData(), and SpecularDataImportWidget::onFormatSelectionChanged().
|
signal |
Emitted whenever contents have been processed.
Referenced by AutomaticDataLoader1D::processContents(), QREDataLoader::processContents(), and RealDataItem::setDataLoader().
|
virtual |
Create a table model which contains the import information like original file content, raw content, processed content. The returned pointer will be owned by the caller. This base class' implementation does nothing (return nullptr).
Reimplemented in QREDataLoader, and AutomaticDataLoader1D.
Definition at line 55 of file AbstractDataLoader.cpp.
Referenced by SpecularDataImportWidget::updatePreview().
|
virtual |
Return the default import settings.
Definition at line 31 of file AbstractDataLoader.cpp.
References clone().
|
virtual |
Initialize from serialization data. If any error occurred, then a DeserializationException has to be thrown. The complete state has to be restored. Therefore if e.g. errors occurred in the former serialization, but errors are not serialized, then they have to be regenerated/ recalculated in here.
Reimplemented in UserDefinedDataLoader1D, QREDataLoader, and AutomaticDataLoader1D.
Definition at line 29 of file AbstractDataLoader.cpp.
Referenced by UserDefinedDataLoader1D::deserialize(), and operator>>().
|
virtual |
Returns the original file content. If not available any more (like for legacy project file import), then an empty array will be returned.
Reimplemented in QREDataLoader, and AutomaticDataLoader1D.
Definition at line 60 of file AbstractDataLoader.cpp.
Referenced by SpecularDataImportWidget::onFormatSelectionChanged(), and UserDefinedDataLoader1D::setFileContents().
|
virtual |
Guess appropriate settings (for example the separator in a CSV file). Is called only once, directly after setting the file content.
Reimplemented in UserDefinedDataLoader1D, and QREDataLoader.
Definition at line 38 of file AbstractDataLoader.cpp.
Referenced by UserDefinedDataLoader1D::guessSettings(), GUI::View::ImportDataUtils::Import1dData(), and SpecularDataImportWidget::onFormatSelectionChanged().
|
signal |
Emitted whenever an import setting changed.
Referenced by UserDefinedDataLoader1D::UserDefinedDataLoader1D(), SpecularDataImportWidget::onFormatSelectionChanged(), QREDataLoader::populateImportSettingsWidget(), and SpecularDataImportWidget::setItem().
|
virtual |
Set import settings to defaults.
Reimplemented in UserDefinedDataLoader1D, and QREDataLoader.
Definition at line 22 of file AbstractDataLoader.cpp.
Referenced by GUI::View::ImportDataUtils::Import1dData(), and SpecularDataImportWidget::onFormatSelectionChanged().
|
virtual |
Errors not related to a particular line.
Reimplemented in QREDataLoader, and AutomaticDataLoader1D.
Definition at line 50 of file AbstractDataLoader.cpp.
Referenced by SpecularDataImportWidget::updatePreview().
|
pure virtual |
The name shown in the format selection combo.
Implemented in UserDefinedDataLoader1D, QREDataLoader, and AutomaticDataLoader1D.
Referenced by SpecularDataImportWidget::fillLoaderCombo(), SpecularDataImportWidget::onFormatSelectionChanged(), and SpecularDataImportWidget::setItem().
|
virtual |
Number of errors found while processing the content. An error means that either a particular content (line) can't be used or may be suspicious (line related error), or that the whole content can't be used (e.g. only 1 line present).
Reimplemented in QREDataLoader, and AutomaticDataLoader1D.
Definition at line 40 of file AbstractDataLoader.cpp.
Referenced by RealDataItem::hasImportErrors(), and SpecularDataImportWidget::updatePreview().
|
virtual |
Number of errors related to a specific line. Such an error means that a particular content (line) can't be used or may be suspicious.
Reimplemented in QREDataLoader.
Definition at line 45 of file AbstractDataLoader.cpp.
|
pure virtual |
A name which can be used for save/load purposes (which will not change ever more)
Implemented in UserDefinedDataLoader1D, QREDataLoader, and AutomaticDataLoader1D.
Referenced by UserDefinedDataLoader1D::persistentClassName().
|
virtual |
Fills the widget on the import dialog pane. The implementation here in the base class does nothing (meaning "no editable properties").
Reimplemented in UserDefinedDataLoader1D, and QREDataLoader.
Definition at line 18 of file AbstractDataLoader.cpp.
Referenced by UserDefinedDataLoader1D::populateImportSettingsWidget(), and SpecularDataImportWidget::updatePropertiesEdits().
|
pure virtual |
Process the file contents. Can be called more than once, e.g. if the import settings have changed. Any error has to be stored in the loader (see numErrors()).
Implemented in UserDefinedDataLoader1D, QREDataLoader, and AutomaticDataLoader1D.
Referenced by GUI::View::ImportDataUtils::Import1dData(), SpecularDataImportWidget::onFormatSelectionChanged(), SpecularDataImportWidget::onPropertiesChanged(), and UserDefinedDataLoader1D::processContents().
RealDataItem * AbstractDataLoader::realDataItem | ( | ) |
The real data item on which the import shall work.
Definition at line 70 of file AbstractDataLoader.cpp.
References m_item.
const RealDataItem * AbstractDataLoader::realDataItem | ( | ) | const |
The real data item on which the import shall work.
Definition at line 75 of file AbstractDataLoader.cpp.
References m_item.
|
virtual |
Returns every internal setting so it can be restored completely.
Reimplemented in UserDefinedDataLoader1D, QREDataLoader, and AutomaticDataLoader1D.
Definition at line 24 of file AbstractDataLoader.cpp.
Referenced by cloneAsUserDefinedLoader(), operator<<(), and UserDefinedDataLoader1D::serialize().
|
pure virtual |
Sets the file contents to be imported. If the file was a compressed file, then the decompressed content will be handed over already here.
Implemented in UserDefinedDataLoader1D, QREDataLoader, and AutomaticDataLoader1D.
Referenced by GUI::View::ImportDataUtils::Import1dData(), SpecularDataImportWidget::onFormatSelectionChanged(), and UserDefinedDataLoader1D::setFileContents().
void AbstractDataLoader::setRealDataItem | ( | RealDataItem * | item | ) |
Define the real data item on which the import shall work.
Definition at line 65 of file AbstractDataLoader.cpp.
References m_item.
Referenced by GUI::View::ImportDataUtils::Import1dData(), and SpecularDataImportWidget::onFormatSelectionChanged().
|
protected |
The real-data-item which owns this loader. Never delete this!
Definition at line 124 of file AbstractDataLoader.h.
Referenced by AutomaticDataLoader1D::createResultModel(), AutomaticDataLoader1D::processContents(), QREDataLoader::processContents(), realDataItem(), and setRealDataItem().