-
Notifications
You must be signed in to change notification settings - Fork 0
/
run_status.hxx
103 lines (83 loc) · 1.88 KB
/
run_status.hxx
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
90
91
92
93
94
95
96
97
98
99
100
101
102
103
#ifndef QMC_H_RUNSTAT
# define QMC_H_RUNSTAT
# include "base.hxx"
namespace qmc
{
enum status
{
stopped = 0 ,
running ,
error ,
abort
};
class run_status
{
private:
flag32_t _flag;
public:
run_status();
run_status(const run_status& src) = default;
run_status(run_status&& rv_src) = default;
run_status(flag32_t& x);
run_status(flag32_t flag);
bool running();
bool error();
bool abort();
bool stopped();
bool operator==(const run_status& x);
void set_running();
void set_stopped();
void set_error();
void set_abort();
~run_status() = default;
};
run_status::run_status()
{
this->set_stopped();
}
run_status::run_status(flag32_t& x)
{
x = this->_flag;
}
run_status::run_status(flag32_t flag)
{
this->_flag = flag;
}
bool run_status::operator==(const run_status& x)
{
return this->_flag == x._flag;
}
bool run_status::abort()
{
return this->_flag == status::abort;
}
bool run_status::error()
{
return this->_flag == status::error;
}
bool run_status::stopped()
{
return this->_flag == status::stopped;
}
bool run_status::running()
{
return this->_flag == status::running;
}
void run_status::set_stopped()
{
this->_flag = status::stopped;
}
void run_status::set_abort()
{
this->_flag = status::abort;
}
void run_status::set_running()
{
this->_flag = status::running;
}
void run_status::set_error()
{
this->_flag = status::error;
}
} // namespace qmc
#endif // QMC_H_RUNSTAT