-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathStrategyContextActionMethods.h
More file actions
executable file
·200 lines (159 loc) · 5.19 KB
/
Copy pathStrategyContextActionMethods.h
File metadata and controls
executable file
·200 lines (159 loc) · 5.19 KB
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
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
#ifndef BaseLib_Templates_StrategyContextActionMethods_h_Included
#define BaseLib_Templates_StrategyContextActionMethods_h_Included
#include"BaseLib/CommonDefines.h"
#include"BaseLib/Templates/ActionHolder.h"
#include"BaseLib/Templates/StrategyActionMethods.h"
namespace BaseLib { namespace Templates
{
// ------------------------------------------------
// Action invokers/decorators to hide parameterized Actions
// ------------------------------------------------
template <typename Return>
class StrategyContextAction0 : public StrategyAction0Invoker<Return>
{
public:
StrategyContextAction0(ActionContextPtr context, typename Strategy0<Return>::Ptr action)
: StrategyAction0Invoker<Return>(action)
, context_(context)
{}
virtual ~StrategyContextAction0()
{}
CLASS_TRAITS(StrategyContextAction0)
virtual void Exit()
{
context_->Exit();
}
virtual void Entry()
{
context_->Entry();
}
private:
ActionContextPtr context_;
};
// ------------------------------------------------
// Action invokers/decorators to hide parameterized Actions
// ------------------------------------------------
template <typename Return, typename Arg1>
class StrategyContextAction1 : public StrategyAction1Invoker<Return, Arg1>
{
public:
StrategyContextAction1(ActionContextPtr context, typename Strategy1<Return, Arg1>::Ptr action, Arg1 arg1)
: StrategyAction1Invoker<Return, Arg1>(action, arg1)
, context_(context)
{}
virtual ~StrategyContextAction1()
{}
CLASS_TRAITS(StrategyContextAction1)
virtual void Exit()
{
context_->Exit();
}
virtual void Entry()
{
context_->Entry();
}
private:
ActionContextPtr context_;
};
// ------------------------------------------------
// Action invokers/decorators to hide parameterized Actions
// ------------------------------------------------
template <typename Return, typename Arg1, typename Arg2>
class StrategyContextAction2 : public StrategyAction2Invoker<Return, Arg1, Arg2>
{
public:
StrategyContextAction2(ActionContextPtr context, typename Strategy2<Return, Arg1, Arg2>::Ptr action, Arg1 arg1, Arg2 arg2)
: StrategyAction2Invoker<Return, Arg1, Arg2>(action, arg1, arg2)
, context_(context)
{}
virtual ~StrategyContextAction2()
{}
CLASS_TRAITS(StrategyContextAction2)
virtual void Exit()
{
context_->Exit();
}
virtual void Entry()
{
context_->Entry();
}
private:
ActionContextPtr context_;
};
// ------------------------------------------------
// Action invokers/decorators to hide parameterized Actions
// ------------------------------------------------
template <typename Return, typename Arg1, typename Arg2, typename Arg3>
class StrategyContextAction3 : public StrategyAction3Invoker<Return, Arg1, Arg2, Arg3>
{
public:
StrategyContextAction3(ActionContextPtr context, typename Strategy3<Return, Arg1, Arg2, Arg3>::Ptr action, Arg1 arg1, Arg2 arg2, Arg3 arg3)
: StrategyAction3Invoker<Return, Arg1, Arg2, Arg3>(action, arg1, arg2, arg3)
, context_(context)
{}
virtual ~StrategyContextAction3()
{}
CLASS_TRAITS(StrategyContextAction3)
virtual void Exit()
{
context_->Exit();
}
virtual void Entry()
{
context_->Entry();
}
private:
ActionContextPtr context_;
};
// ------------------------------------------------
// Action invokers/decorators to hide parameterized Actions
// ------------------------------------------------
template <typename Return, typename Arg1, typename Arg2, typename Arg3, typename Arg4>
class StrategyContextAction4 : public StrategyAction4Invoker<Return, Arg1, Arg2, Arg3, Arg4>
{
public:
StrategyContextAction4(ActionContextPtr context, typename Strategy4<Return, Arg1, Arg2, Arg3, Arg4>::Ptr action, Arg1 arg1, Arg2 arg2, Arg3 arg3, Arg4 arg4)
: StrategyAction4Invoker<Return, Arg1, Arg2, Arg3, Arg4>(action, arg1, arg2, arg3, arg4)
, context_(context)
{}
virtual ~StrategyContextAction4()
{}
CLASS_TRAITS(StrategyContextAction4)
virtual void Exit()
{
context_->Exit();
}
virtual void Entry()
{
context_->Entry();
}
private:
ActionContextPtr context_;
};
// ------------------------------------------------
// Action invokers/decorators to hide parameterized Actions
// ------------------------------------------------
template <typename Return, typename Arg1, typename Arg2, typename Arg3, typename Arg4, typename Arg5>
class StrategyContextAction5 : public StrategyAction5Invoker<Return, Arg1, Arg2, Arg3, Arg4, Arg5>
{
public:
StrategyContextAction5(ActionContextPtr context, typename Strategy5<Return, Arg1, Arg2, Arg3, Arg4, Arg5>::Ptr action, Arg1 arg1, Arg2 arg2, Arg3 arg3, Arg4 arg4, Arg5 arg5)
: StrategyAction5Invoker<Return, Arg1, Arg2, Arg3, Arg4, Arg5>(action, arg1, arg2, arg3, arg4, arg5)
, context_(context)
{}
virtual ~StrategyContextAction5()
{}
CLASS_TRAITS(StrategyContextAction5)
virtual void Exit()
{
context_->Exit();
}
virtual void Entry()
{
context_->Entry();
}
private:
ActionContextPtr context_;
};
}}
#endif