BornAgain  1.19.79
Simulate and fit neutron and x-ray scattering at grazing incidence
DataLoaderUtil.cpp File Reference

Description

Implements class UserDefinedDataLoader1D.

Homepage:\n http://www.bornagainproject.org
License:\n GNU General Public License v3 or higher (see COPYING)
Authors
Scientific Computing Group at MLZ (see CITATION, AUTHORS)

Definition in file DataLoaderUtil.cpp.

Include dependency graph for DataLoaderUtil.cpp:

Go to the source code of this file.

Functions

void cloneAsUserDefinedLoader (AbstractDataLoader1D *loader, const QString &name)
 clones the loader as a user defined loader and puts it in DataLoaders1D store More...
 
void register1DDataLoaders ()
 register the concrete data loaders with the registration facility More...
 

Function Documentation

◆ cloneAsUserDefinedLoader()

void cloneAsUserDefinedLoader ( AbstractDataLoader1D loader,
const QString &  name 
)

clones the loader as a user defined loader and puts it in DataLoaders1D store

Definition at line 21 of file DataLoaderUtil.cpp.

22 {
23  loader->applyImportSettings();
24  auto* clonedLoader = dynamic_cast<AbstractDataLoader1D*>(loader->clone());
25  const auto defaultProperties = loader->serialize();
26 
28  new UserDefinedDataLoader1D(clonedLoader, name, defaultProperties));
29 }
Abstract base class for reflectometry data loaders.
virtual QByteArray serialize() const
Returns every internal setting so it can be restored completely.
virtual void applyImportSettings()
Read all values from the properties UI into the internal variables.
virtual AbstractDataLoader * clone() const =0
Create a complete clone, including all internal states.
void addUserDefinedLoader(AbstractDataLoader1D *loader)
add a user defined loader
static DataLoaders1D & instance()
The one and only instance.
A user defined data loader. This is a thin wrapper around the real loader implementation,...
QString const & name(EShape k)
Definition: particles.cpp:20

References DataLoaders1D::addUserDefinedLoader(), AbstractDataLoader::applyImportSettings(), AbstractDataLoader::clone(), DataLoaders1D::instance(), GUI::RealSpace::Particles::name(), and AbstractDataLoader::serialize().

Referenced by SpecularDataImportWidget::onCreateNewFormatButton().

Here is the call graph for this function:

◆ register1DDataLoaders()

void register1DDataLoaders ( )

register the concrete data loaders with the registration facility

register the concrete 1D data loaders with DataLoaders1D

Definition at line 49 of file DataLoaderUtil.cpp.

50 {
51  // the ordering in here defines the ordering in the selection combo box in the open file dialog
52  // and also in the selection combo box on the format configuration page. Furthermore the first
53  // returned loader will be used as default in the open file dialog if it is started for the
54  // first time
55  DataLoaders1D::instance().addBuiltInLoader(QREDataLoader().persistentClassName(),
56  createQREDataLoader);
58  createAutomaticDataLoader1D);
59 }
The legacy importer for reflectometry, with no user interaction.
void addBuiltInLoader(const QString &persistentClassName, const std::function< AbstractDataLoader1D *()> &create)
Register a built-in loader with the given class name and factory function.
Loader for experimental reflectometry CSV files that contain three columns with Q,...
Definition: QREDataLoader.h:29

References DataLoaders1D::addBuiltInLoader(), and DataLoaders1D::instance().

Referenced by main().

Here is the call graph for this function: