BornAgain  1.19.79
Simulate and fit neutron and x-ray scattering at grazing incidence
UserDefinedDataLoader1D.cpp
Go to the documentation of this file.
1 // ************************************************************************************************
2 //
3 // BornAgain: simulate and fit reflection and scattering
4 //
5 //! @file GUI/View/Loaders/UserDefinedDataLoader1D.cpp
6 //! @brief Implements 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 
16 
17 #include <utility>
18 
20  QByteArray defaultProperties)
21  : m_name(std::move(name))
22  , m_wrappedLoader(wrappedLoader)
23  , m_defaultProperties(std::move(defaultProperties))
24 {
27 }
28 
30 {
31  return m_name;
32 }
33 
35 {
37 }
38 
40 {
42 }
43 
45 {
47 }
48 
50 {
51  return m_wrappedLoader->serialize();
52 }
53 
54 void UserDefinedDataLoader1D::deserialize(const QByteArray& data)
55 {
57 }
58 
60 {
61  auto* cloned = dynamic_cast<AbstractDataLoader1D*>(m_wrappedLoader->clone());
62  auto* loader = new UserDefinedDataLoader1D(cloned, m_name, m_defaultProperties);
63  return loader;
64 }
65 
66 void UserDefinedDataLoader1D::setFileContents(const QByteArray& fileContent)
67 {
69 }
70 
72 {
74 }
75 
77 {
79 }
Defines class UserDefinedDataLoader1D.
Abstract base class for reflectometry data loaders.
Abstract base class for all data loaders (classes to import real data).
virtual QByteArray serialize() const
Returns every internal setting so it can be restored completely.
virtual void populateImportSettingsWidget(QWidget *parent)
Fills the widget on the import dialog pane. The implementation here in the base class does nothing (m...
virtual void guessSettings()
Guess appropriate settings (for example the separator in a CSV file). Is called only once,...
void importSettingsChanged()
Emitted whenever an import setting changed.
virtual QString persistentClassName() const =0
A name which can be used for save/load purposes (which will not change ever 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 conte...
virtual void deserialize(const QByteArray &data)
Initialize from serialization data. If any error occurred, then a DeserializationException has to be ...
virtual void processContents()=0
Process the file contents. Can be called more than once, e.g. if the import settings have changed....
virtual QByteArray fileContent() const
Returns the original file content. If not available any more (like for legacy project file import),...
virtual AbstractDataLoader * clone() const =0
Create a complete clone, including all internal states.
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.
QString const & name(EShape k)
Definition: particles.cpp:20