BornAgain  1.19.0
Simulate and fit neutron and x-ray scattering at grazing incidence
OutputDataIOService.h
Go to the documentation of this file.
1 // ************************************************************************************************
2 //
3 // BornAgain: simulate and fit reflection and scattering
4 //
5 //! @file GUI/coregui/mainwindow/OutputDataIOService.h
6 //! @brief Defines class OutputDataIOService
7 //!
8 //! @homepage http://www.bornagainproject.org
9 //! @license GNU General Public License v3 or higher (see COPYING)
10 //! @copyright Forschungszentrum Jülich GmbH 2018
11 //! @authors Scientific Computing Group at MLZ (see CITATION, AUTHORS)
12 //
13 // ************************************************************************************************
14 
15 #ifndef BORNAGAIN_GUI_COREGUI_MAINWINDOW_OUTPUTDATAIOSERVICE_H
16 #define BORNAGAIN_GUI_COREGUI_MAINWINDOW_OUTPUTDATAIOSERVICE_H
17 
19 #include <QObject>
20 
21 class ApplicationModels;
22 class MessageService;
23 class SaveLoadInterface;
24 
25 //! Provide read/write of heavy data files in a separate thread.
26 //!
27 //! Listens all models and keep tracks of changes in items. Provides logic to
28 //! not to re-save already saved data.
29 
30 class OutputDataIOService : public QObject {
31  Q_OBJECT
32 public:
33  explicit OutputDataIOService(QObject* parent = nullptr);
34  explicit OutputDataIOService(ApplicationModels* models, QObject* parent = nullptr);
35 
37 
38  void save(const QString& projectDir);
39 
40  void load(const QString& projectDir, MessageService* messageService = nullptr);
41 
42  QVector<SaveLoadInterface*> nonXMLItems() const;
43 
44 private:
45  void cleanOldFiles(const QString& projectDir, const QStringList& oldSaves,
46  const QStringList& newSaves);
47 
50 };
51 
52 #endif // BORNAGAIN_GUI_COREGUI_MAINWINDOW_OUTPUTDATAIOSERVICE_H
Defines OutputDataIOHistory classes.
The service to collect messages from different senders.
Save history information for set of directories.
Provide read/write of heavy data files in a separate thread.
void load(const QString &projectDir, MessageService *messageService=nullptr)
void setApplicationModels(ApplicationModels *models)
QVector< SaveLoadInterface * > nonXMLItems() const
Returns all non-XML items available for save/load.
ApplicationModels * m_applicationModels
OutputDataIOHistory m_history
OutputDataIOService(QObject *parent=nullptr)
void save(const QString &projectDir)
void cleanOldFiles(const QString &projectDir, const QStringList &oldSaves, const QStringList &newSaves)
Clean old saved files.
Purely virtual interface to handle non-XML data save and load.
QString projectDir(const QString &projectFileName)
Returns project directory deduced from project file name.