BornAgain  1.19.79
Simulate and fit neutron and x-ray scattering at grazing incidence
JobStatus.cpp
Go to the documentation of this file.
1 // ************************************************************************************************
2 //
3 // BornAgain: simulate and fit reflection and scattering
4 //
5 //! @file GUI/Support/Data/JobStatus.cpp
6 //! @brief Implements class JobWorker
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 
16 #include "Base/Util/Assert.h"
17 
18 #include <boost/bimap.hpp>
19 
20 namespace {
21 
22 const std::vector<boost::bimap<JobStatus, QString>::value_type> values = {
23  {JobStatus::Idle, "Idle"}, {JobStatus::Running, "Running"},
24  {JobStatus::Fitting, "Fitting"}, {JobStatus::Completed, "Completed"},
25  {JobStatus::Canceled, "Canceled"}, {JobStatus::Failed, "Failed"}};
26 
27 const boost::bimap<JobStatus, QString> status2name(values.begin(), values.end());
28 
29 } // namespace
30 
31 
33 {
34  auto it = status2name.left.find(status);
35  ASSERT(it != status2name.left.end());
36  return it->second;
37 }
38 
40 {
41  auto it = status2name.right.find(name);
42  ASSERT(it != status2name.right.end());
43  return it->second;
44 }
QString jobStatusToString(JobStatus status)
get a string representation of the status
Definition: JobStatus.cpp:32
JobStatus jobStatusFromString(const QString &name)
get status value for given string representation
Definition: JobStatus.cpp:39
Defines enum JobStatus.
JobStatus
The JobStatus enum lists the possible states of a job.
Definition: JobStatus.h:22
@ Completed
the job was successfully completed
@ Canceled
the job was stopped by the user
@ Running
the job is busy calculating
@ Failed
the job aborted because it hit an error
@ Idle
the job has not been started yet
@ Fitting
the job is busy fitting
QString const & name(EShape k)
Definition: particles.cpp:20