| 1 |
#ifndef MPSOLVEWORKER_H |
| 2 |
#define MPSOLVEWORKER_H |
| 3 |
|
| 4 |
#include <QThread> |
| 5 |
#include <mps/mps.h> |
| 6 |
|
| 7 |
namespace xmpsolve { |
| 8 |
|
| 9 |
class MPSolveWorker : public QThread |
| 10 |
{ |
| 11 |
Q_OBJECT |
| 12 |
public: |
| 13 |
explicit MPSolveWorker(mps_context * s = NULL, QObject *parent = 0); |
| 14 |
|
| 15 |
/** |
| 16 |
* @brief setMpsContext can be used to set the current mps_context |
| 17 |
* for the computation. |
| 18 |
* @param ctx is the pointer to the current mps_context. |
| 19 |
*/ |
| 20 |
void setMpsContext(mps_context * ctx); |
| 21 |
|
| 22 |
/** |
| 23 |
* @brief run Actually start the computation calling mps_mpsolve(); |
| 24 |
*/ |
| 25 |
void run(); |
| 26 |
|
| 27 |
/** |
| 28 |
* @brief CPUTime gets the number of ms of CPU time used by the |
| 29 |
* last call to run(). |
| 30 |
* @return The number of ms of CPU time spent on the last run. |
| 31 |
*/ |
| 32 |
unsigned long int CPUTime(); |
| 33 |
|
| 34 |
/** |
| 35 |
* @brief Abort the current computation. |
| 36 |
*/ |
| 37 |
void abortComputation(); |
| 38 |
|
| 39 |
/** |
| 40 |
* @brief The timer used to check how long MPSolve needs to solve a polynomial. |
| 41 |
*/ |
| 42 |
clock_t* m_timer; |
| 43 |
|
| 44 |
/** |
| 45 |
* @brief The time measured with the timer. |
| 46 |
*/ |
| 47 |
unsigned long int m_time; |
| 48 |
|
| 49 |
private: |
| 50 |
mps_context * m_context; |
| 51 |
|
| 52 |
signals: |
| 53 |
|
| 54 |
public slots: |
| 55 |
|
| 56 |
}; |
| 57 |
|
| 58 |
} // Namespace xmpsolve |
| 59 |
|
| 60 |
#endif // MPSOLVEWORKER_H |