BornAgain  1.19.79
Simulate and fit neutron and x-ray scattering at grazing incidence
UserDefinedDataLoader1D.h
Go to the documentation of this file.
1 // ************************************************************************************************
2 //
3 // BornAgain: simulate and fit reflection and scattering
4 //
5 //! @file GUI/View/Loaders/UserDefinedDataLoader1D.h
6 //! @brief Defines class UserDefinedDataLoader1D
7 //!
8 //! @homepage http://www.bornagainproject.org
9 //! @license GNU General Public License v3 or higher (see COPYING)
10 //! @copyright Forschungszentrum Jülich GmbH 2021
11 //! @authors Scientific Computing Group at MLZ (see CITATION, AUTHORS)
12 //
13 // ************************************************************************************************
14 
15 #ifndef BORNAGAIN_GUI_VIEW_LOADERS_USERDEFINEDDATALOADER1D_H
16 #define BORNAGAIN_GUI_VIEW_LOADERS_USERDEFINEDDATALOADER1D_H
17 
19 
20 //! A user defined data loader. This is a thin wrapper around the real loader implementation,
21 //! storing the relevant settings to make it user definable (namely name and import settings).
22 
24 public:
25  UserDefinedDataLoader1D(AbstractDataLoader1D* wrappedLoader, QString name,
26  QByteArray defaultProperties);
27 
28  QString name() const override;
29  void populateImportSettingsWidget(QWidget* parent) override;
30  void initWithDefaultImportSettings() override;
31  QString persistentClassName() const override;
32  QByteArray serialize() const override;
33  void deserialize(const QByteArray& data) override;
34  AbstractDataLoader* clone() const override;
35  void setFileContents(const QByteArray& fileContent) override;
36  void guessSettings() override;
37  void processContents() override;
38 
39  // #baUserDefLoaders ++ implement all overloads!
40 private:
41  QString m_name;
43  QByteArray m_defaultProperties;
44 };
45 
46 #endif // BORNAGAIN_GUI_VIEW_LOADERS_USERDEFINEDDATALOADER1D_H
Defines class AbstractDataLoader1D.
Abstract base class for reflectometry data loaders.
Abstract base class for all data loaders (classes to import real data).
virtual QByteArray fileContent() const
Returns the original file content. If not available any more (like for legacy project file import),...
A user defined data loader. This is a thin wrapper around the real loader implementation,...
void populateImportSettingsWidget(QWidget *parent) override
Fills the widget on the import dialog pane. The implementation here in the base class does nothing (m...
AbstractDataLoader * clone() const override
Create a complete clone, including all internal states.
void guessSettings() override
Guess appropriate settings (for example the separator in a CSV file). Is called only once,...
UserDefinedDataLoader1D(AbstractDataLoader1D *wrappedLoader, QString name, QByteArray defaultProperties)
QString persistentClassName() const override
A name which can be used for save/load purposes (which will not change ever more)
void deserialize(const QByteArray &data) override
Initialize from serialization data. If any error occurred, then a DeserializationException has to be ...
void setFileContents(const QByteArray &fileContent) override
Sets the file contents to be imported. If the file was a compressed file, then the decompressed conte...
QByteArray serialize() const override
Returns every internal setting so it can be restored completely.
AbstractDataLoader1D * m_wrappedLoader
void processContents() override
Process the file contents. Can be called more than once, e.g. if the import settings have changed....
void initWithDefaultImportSettings() override
Set import settings to defaults.
QString name() const override
The name shown in the format selection combo.