BornAgain  1.19.79
Simulate and fit neutron and x-ray scattering at grazing incidence
AbstractDataLoader1D Class Referenceabstract

Description

Abstract base class for reflectometry data loaders.

Definition at line 22 of file AbstractDataLoader1D.h.

Inheritance diagram for AbstractDataLoader1D:
[legend]
Collaboration diagram for AbstractDataLoader1D:
[legend]

Signals

void contentsProcessed ()
 Emitted whenever contents have been processed. More...
 
void importSettingsChanged ()
 Emitted whenever an import setting changed. More...
 

Public Member Functions

virtual void applyImportSettings ()
 Read all values from the properties UI into the internal variables. More...
 
virtual AbstractDataLoaderclone () const =0
 Create a complete clone, including all internal states. More...
 
virtual AbstractDataLoaderResultModelcreateResultModel () 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...
 
RealDataItemrealDataItem ()
 The real data item on which the import shall work. More...
 
const RealDataItemrealDataItem () 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

RealDataItemm_item
 The real-data-item which owns this loader. Never delete this! More...
 

Member Function Documentation

◆ applyImportSettings()

void AbstractDataLoader::applyImportSettings ( )
virtualinherited

Read all values from the properties UI into the internal variables.

Reimplemented in QREDataLoader.

Definition at line 20 of file AbstractDataLoader.cpp.

20 {}

Referenced by cloneAsUserDefinedLoader(), and SpecularDataImportWidget::onPropertiesChanged().

◆ clone()

◆ contentsProcessed

void AbstractDataLoader::contentsProcessed ( )
signalinherited

Emitted whenever contents have been processed.

Referenced by AutomaticDataLoader1D::processContents(), QREDataLoader::processContents(), and RealDataItem::setDataLoader().

◆ createResultModel()

AbstractDataLoaderResultModel * AbstractDataLoader::createResultModel ( ) const
virtualinherited

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.

56 {
57  return nullptr;
58 }

Referenced by SpecularDataImportWidget::updatePreview().

◆ defaultImportSettings()

QByteArray AbstractDataLoader::defaultImportSettings ( ) const
virtualinherited

Return the default import settings.

Definition at line 31 of file AbstractDataLoader.cpp.

32 {
33  std::unique_ptr<AbstractDataLoader> cloned(clone());
34  cloned->initWithDefaultImportSettings();
35  return cloned->serialize();
36 }
virtual AbstractDataLoader * clone() const =0
Create a complete clone, including all internal states.

References AbstractDataLoader::clone().

Here is the call graph for this function:

◆ deserialize()

void AbstractDataLoader::deserialize ( const QByteArray &  data)
virtualinherited

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.

29 {}

Referenced by UserDefinedDataLoader1D::deserialize(), and operator>>().

◆ fileContent()

QByteArray AbstractDataLoader::fileContent ( ) const
virtualinherited

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.

61 {
62  return {};
63 }

Referenced by SpecularDataImportWidget::onFormatSelectionChanged(), and UserDefinedDataLoader1D::setFileContents().

◆ guessSettings()

void AbstractDataLoader::guessSettings ( )
virtualinherited

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.

38 {}

Referenced by UserDefinedDataLoader1D::guessSettings(), GUI::View::ImportDataUtils::Import1dData(), and SpecularDataImportWidget::onFormatSelectionChanged().

◆ importSettingsChanged

void AbstractDataLoader::importSettingsChanged ( )
signalinherited

◆ initWithDefaultImportSettings()

void AbstractDataLoader::initWithDefaultImportSettings ( )
virtualinherited

Set import settings to defaults.

Reimplemented in UserDefinedDataLoader1D, and QREDataLoader.

Definition at line 22 of file AbstractDataLoader.cpp.

22 {}

Referenced by GUI::View::ImportDataUtils::Import1dData(), and SpecularDataImportWidget::onFormatSelectionChanged().

◆ lineUnrelatedErrors()

QStringList AbstractDataLoader::lineUnrelatedErrors ( ) const
virtualinherited

Errors not related to a particular line.

Reimplemented in QREDataLoader, and AutomaticDataLoader1D.

Definition at line 50 of file AbstractDataLoader.cpp.

51 {
52  return {};
53 }

Referenced by SpecularDataImportWidget::updatePreview().

◆ name()

virtual QString AbstractDataLoader::name ( ) const
pure virtualinherited

◆ numErrors()

int AbstractDataLoader::numErrors ( ) const
virtualinherited

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.

41 {
42  return 0;
43 }

Referenced by RealDataItem::hasImportErrors(), and SpecularDataImportWidget::updatePreview().

◆ numLineRelatedErrors()

int AbstractDataLoader::numLineRelatedErrors ( ) const
virtualinherited

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.

46 {
47  return 0;
48 }

◆ persistentClassName()

virtual QString AbstractDataLoader::persistentClassName ( ) const
pure virtualinherited

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().

◆ populateImportSettingsWidget()

void AbstractDataLoader::populateImportSettingsWidget ( QWidget *  parent)
virtualinherited

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.

18 {}

Referenced by UserDefinedDataLoader1D::populateImportSettingsWidget(), and SpecularDataImportWidget::updatePropertiesEdits().

◆ processContents()

virtual void AbstractDataLoader::processContents ( )
pure virtualinherited

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() [1/2]

RealDataItem * AbstractDataLoader::realDataItem ( )
inherited

The real data item on which the import shall work.

Definition at line 70 of file AbstractDataLoader.cpp.

71 {
72  return m_item;
73 }
RealDataItem * m_item
The real-data-item which owns this loader. Never delete this!

References AbstractDataLoader::m_item.

◆ realDataItem() [2/2]

const RealDataItem * AbstractDataLoader::realDataItem ( ) const
inherited

The real data item on which the import shall work.

Definition at line 75 of file AbstractDataLoader.cpp.

76 {
77  return m_item;
78 }

References AbstractDataLoader::m_item.

◆ serialize()

QByteArray AbstractDataLoader::serialize ( ) const
virtualinherited

Returns every internal setting so it can be restored completely.

Reimplemented in UserDefinedDataLoader1D, QREDataLoader, and AutomaticDataLoader1D.

Definition at line 24 of file AbstractDataLoader.cpp.

25 {
26  return QByteArray();
27 }

Referenced by cloneAsUserDefinedLoader(), operator<<(), and UserDefinedDataLoader1D::serialize().

◆ setFileContents()

virtual void AbstractDataLoader::setFileContents ( const QByteArray &  fileContent)
pure virtualinherited

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().

◆ setRealDataItem()

void AbstractDataLoader::setRealDataItem ( RealDataItem item)
inherited

Define the real data item on which the import shall work.

Definition at line 65 of file AbstractDataLoader.cpp.

66 {
67  m_item = item;
68 }

References AbstractDataLoader::m_item.

Referenced by GUI::View::ImportDataUtils::Import1dData(), and SpecularDataImportWidget::onFormatSelectionChanged().

Member Data Documentation

◆ m_item

RealDataItem* AbstractDataLoader::m_item
protectedinherited

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