-
Notifications
You must be signed in to change notification settings - Fork 3
/
task.h
65 lines (53 loc) · 1.13 KB
/
task.h
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
#ifndef TASK_H
#define TASK_H
#include <mutex>
#include <condition_variable>
#include <atomic>
struct graph;
struct curve;
class Task {
public:
virtual ~Task();
virtual void perform() = 0;
virtual bool canPerformNow() = 0;
int isDone();
std::string whatHappened();
graph* getData();
protected:
Task(graph* data);
void setDone(int value);
graph* data_;
std::atomic_short done_;
std::string error_;
std::mutex mutex;
std::condition_variable condvar;
};
class TaskLoad : public Task {
public:
TaskLoad(graph* data);
virtual ~TaskLoad();
virtual void perform();
virtual bool canPerformNow();
};
class TaskDerivative : public Task {
public:
TaskDerivative(graph* data);
virtual ~TaskDerivative();
virtual void perform();
virtual bool canPerformNow();
};
class TaskIntegral : public Task {
public:
TaskIntegral(graph* data);
virtual ~TaskIntegral();
virtual void perform();
virtual bool canPerformNow();
};
class TaskFit : public Task {
public:
TaskFit(graph* data);
virtual ~TaskFit();
virtual void perform();
virtual bool canPerformNow();
};
#endif // TASK_H