BornAgain  1.19.79
Simulate and fit neutron and x-ray scattering at grazing incidence
IOService.h
Go to the documentation of this file.
1 // ************************************************************************************************
2 //
3 // BornAgain: simulate and fit reflection and scattering
4 //
5 //! @file GUI/Model/Project/IOService.h
6 //! @brief Defines class DatafieldIOService
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_MODEL_PROJECT_IOSERVICE_H
16 #define BORNAGAIN_GUI_MODEL_PROJECT_IOSERVICE_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 DatafieldIOService : public QObject {
31  Q_OBJECT
32 public:
33  explicit DatafieldIOService(QObject* parent = nullptr);
34  explicit DatafieldIOService(ApplicationModels* models, QObject* parent = nullptr);
35 
37 
38  void save(const QString& projectDir);
39 
40  void loadDataFiles(const QString& projectDir, MessageService* messageService = nullptr);
41 
42  QVector<SaveLoadInterface*> dataInterfaces() const;
43 
44 private:
45  void cleanOldFiles(const QString& projectDir, const QStringList& oldSaves,
46  const QStringList& newSaves);
47 
50 };
51 
52 #endif // BORNAGAIN_GUI_MODEL_PROJECT_IOSERVICE_H
Defines DatafieldIOHistory classes.
Save history information for set of directories.
Definition: IOHistory.h:71
Provide read/write of heavy data files in a separate thread.
Definition: IOService.h:30
ApplicationModels * m_applicationModels
Definition: IOService.h:49
void setApplicationModels(ApplicationModels *models)
Definition: IOService.cpp:50
QVector< SaveLoadInterface * > dataInterfaces() const
Returns all non-XML items available for save/load.
Definition: IOService.cpp:109
DatafieldIOHistory m_history
Definition: IOService.h:48
void save(const QString &projectDir)
Definition: IOService.cpp:55
DatafieldIOService(QObject *parent=nullptr)
Definition: IOService.cpp:35
void cleanOldFiles(const QString &projectDir, const QStringList &oldSaves, const QStringList &newSaves)
Clean old saved files. All files in oldSaves list, which are not in newSaves list,...
Definition: IOService.cpp:126
void loadDataFiles(const QString &projectDir, MessageService *messageService=nullptr)
Definition: IOService.cpp:77
The service to collect messages from different senders.
Abstract base class to handle non-XML data save and load.
QString projectDir(const QString &projectFileName)
Returns project directory deduced from project file name.