BornAgain  1.19.79
Simulate and fit neutron and x-ray scattering at grazing incidence
JobModel.h
Go to the documentation of this file.
1 // ************************************************************************************************
2 //
3 // BornAgain: simulate and fit reflection and scattering
4 //
5 //! @file GUI/Model/Model/JobModel.h
6 //! @brief Defines class JobModel
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_MODEL_JOBMODEL_H
16 #define BORNAGAIN_GUI_MODEL_MODEL_JOBMODEL_H
17 
19 
20 class InstrumentItem;
21 class JobItem;
22 class JobQueueData;
23 class MultiLayerItem;
24 class RealDataItem;
26 
27 class JobModel : public SessionModel {
28  Q_OBJECT
29 
30 public:
31  explicit JobModel(QObject* parent = nullptr);
32  ~JobModel() override;
33 
34  JobItem* getJobItemForIdentifier(const QString& identifier);
35 
36  JobItem* addJob(const MultiLayerItem* sampleItem, const InstrumentItem* instrumentItem,
37  const RealDataItem* realDataItem, const SimulationOptionsItem& optionItem);
38 
39  QVector<JobItem*> jobItems() const;
40 
41  void restore(JobItem* jobItem);
42 
43  bool hasUnfinishedJobs();
44 
45  void clear() override;
46  QVector<SessionItem*> nonXMLItems() const override;
47  void readFrom(QXmlStreamReader* reader, MessageService* messageService = nullptr) override;
48 
49  void runJob(JobItem* jobItem);
50  void cancelJob(JobItem* jobItem);
51  void removeJob(JobItem* jobItem);
52 
53 signals:
54  void focusRequest(JobItem* item);
55  void globalProgress(int);
56 
57 private:
58  //! generates numbered job name with new/unused number
59  QString generateJobName();
61 };
62 
63 #endif // BORNAGAIN_GUI_MODEL_MODEL_JOBMODEL_H
Defines class SessionModel.
Abstract base class for instrument-specific item classes.
void focusRequest(JobItem *item)
void globalProgress(int)
QVector< JobItem * > jobItems() const
Definition: JobModel.cpp:77
void runJob(JobItem *jobItem)
Definition: JobModel.cpp:142
~JobModel() override
Definition: JobModel.cpp:37
void removeJob(JobItem *jobItem)
Definition: JobModel.cpp:152
void restore(JobItem *jobItem)
restore instrument and sample model from backup for given JobItem
Definition: JobModel.cpp:83
bool hasUnfinishedJobs()
Definition: JobModel.cpp:88
JobQueueData * m_queue_data
Definition: JobModel.h:60
JobModel(QObject *parent=nullptr)
Definition: JobModel.cpp:28
JobItem * getJobItemForIdentifier(const QString &identifier)
Definition: JobModel.cpp:42
void clear() override
Definition: JobModel.cpp:100
QString generateJobName()
generates numbered job name with new/unused number
Definition: JobModel.cpp:160
void cancelJob(JobItem *jobItem)
Definition: JobModel.cpp:147
void readFrom(QXmlStreamReader *reader, MessageService *messageService=nullptr) override
Definition: JobModel.cpp:127
QVector< SessionItem * > nonXMLItems() const override
Definition: JobModel.cpp:108
JobItem * addJob(const MultiLayerItem *sampleItem, const InstrumentItem *instrumentItem, const RealDataItem *realDataItem, const SimulationOptionsItem &optionItem)
Main method to add a job.
Definition: JobModel.cpp:52
The JobQueueData class holds all objects/logic to run simulation in a thread.
Definition: JobQueueData.h:28
The service to collect messages from different senders.
Provides access to experimental data, for display and fitting. Owns an AbstractDataLoader.
Definition: RealDataItem.h:33
Base class for a GUI data collection. A collection is e.g. all real data (RealDataModel)....
Definition: SessionModel.h:42
QModelIndex parent(const QModelIndex &child) const override
The SimulationOptionsItem class holds simulation status (run policy, number of threads,...