-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcomputethread.hpp
89 lines (65 loc) · 2.39 KB
/
computethread.hpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
#ifndef COMPUTETHREAD_HPP
#define COMPUTETHREAD_HPP
#include "nucbase.hpp"
#include <QThread>
#include <QString>
#include <vector>
#include <numeric>
using namespace std;
class ComputeThread : public QThread
{
Q_OBJECT
private:
NucBase * _db;
bool seq_ok;
bool folder_mode;
bool input_ok;
QString _seqfolder;
QString _seqfilename;
QString _seqname;
QString _seqval;
vector<int> _selection;
int _mismatches;
int _submatches;
bool _absent;
bool _unmatched;
bool _mapnum;
protected:
vector<int> _progress;
int _maximum;
bool _failed;
QString _status;
QString _message;
public:
explicit ComputeThread(QObject *parent = 0);
~ComputeThread();
void setMismatches(const int mismatches) {_mismatches = mismatches; }
void setSubmatches(const int submatches) {_submatches = submatches; }
void setUnmatched (const bool unmatched ) {_unmatched = unmatched; }
void setAbsent (const bool absent ) {_absent = absent; }
void setDB(const QString & db);
void getLabels(vector<string> & labels) { _db->getLabels(labels); }
int getNlines() { return _db->getNlines(); }
void setSelection(const vector<int> & selection) { _selection = selection; }
void setSeqFolder(const QString & folder) { _seqfolder = folder; seq_ok = true; }
void setSeqFilename(const QString & filename) { _seqfilename = filename; seq_ok = true; }
void setSeqVal (const QString & seqval ) { _seqval = seqval;
input_ok = (_seqval != 0 && _seqname != 0); }
void setSeqName(const QString & seqname) { _seqname = seqname;
input_ok = (_seqval != 0 && _seqname != 0); }
void setFolderMode(const bool val) { folder_mode = val;
seq_ok = ((_seqfolder != 0) && folder_mode)
|| ((_seqfilename != 0) && !folder_mode); }
void setMapnum(const bool val) { _mapnum = val; }
bool isReady() { return !_selection.empty() && (seq_ok || input_ok); }
const int & getMaximum() { return _maximum; }
int getProgress() { return accumulate(_progress.begin(),_progress.end(),0); }
//const int getProgress() { return _progress; }
const QString & getStatus() { return _status; }
const QString & getMessage() { return _message; }
bool failed() { return _failed; }
void run();
signals:
public slots:
};
#endif // COMPUTETHREAD_H