-
Notifications
You must be signed in to change notification settings - Fork 1
/
doppl_data_member.hpp
56 lines (44 loc) · 1.1 KB
/
doppl_data_member.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
#ifndef _DOPPL_DATA_MEMBER
#define _DOPPL_DATA_MEMBER
#include "doppl_libs.hpp"
#include "doppl_forward_decl.hpp"
namespace doppl {
template<typename T>
class task_member<semantic_action_specifier::data, T> {
private:
T _data;
public:
//Get value
const T& get() {
return _data;
};
//data = data
DM<T>& set(DM<T>& input) {
this->_data = input._data;
return *this;
};
//data = future
DM<T>& set(FM<T>& input) {
this->_data = input.get();
return *this;
};
//data = state
template<typename... Ts>
DM<T>& set(SM<T, Ts...>& input, Ts&... args) {
FM<T> _future(input, true, args...);
this->set(_future);
return *this;
};
//data = value
DM<T>& set(T&& input) {
this->_data = input;
return *this;
};
task_member() {};
template<typename... Ts>
task_member(Ts&... input) {
this->set(input...);
};
};
};
#endif