BornAgain  1.19.79
Open-source research software to simulate and fit neutron and x-ray reflectometry and grazing-incidence small-angle scattering
ComputationStatus.h
Go to the documentation of this file.
1 // ************************************************************************************************
2 //
3 // BornAgain: simulate and fit reflection and scattering
4 //
5 //! @file Sim/Computation/ComputationStatus.h
6 //! @brief Defines and implements interface class ComputationStatus.
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 #ifdef SWIG
16 #error no need to expose this header to Swig
17 #endif
18 
19 #ifndef USER_API
20 #ifndef BORNAGAIN_SIM_COMPUTATION_COMPUTATIONSTATUS_H
21 #define BORNAGAIN_SIM_COMPUTATION_COMPUTATIONSTATUS_H
22 
23 #include <string>
24 
25 //! Completion status (flag and text) of a numeric computation.
26 
28 public:
30  : m_status(IDLE)
31  {
32  }
33 
34  bool isCompleted() const { return m_status == COMPLETED; }
35  std::string errorMessage() const { return m_error_message; }
36 
37  void setRunning() { m_status = RUNNING; }
39  void setFailed(const std::string& message)
40  {
41  m_error_message = message;
42  m_status = FAILED;
43  }
44 
45 private:
47 
49  std::string m_error_message;
50 };
51 
52 #endif // BORNAGAIN_SIM_COMPUTATION_COMPUTATIONSTATUS_H
53 #endif // USER_API
Completion status (flag and text) of a numeric computation.
std::string errorMessage() const
ESimulationStatus m_status
bool isCompleted() const
std::string m_error_message
void setFailed(const std::string &message)