1/**************************************************************************/
2/* server_wrap_mt_common.h */
3/**************************************************************************/
4/* This file is part of: */
5/* GODOT ENGINE */
6/* https://godotengine.org */
7/**************************************************************************/
8/* Copyright (c) 2014-present Godot Engine contributors (see AUTHORS.md). */
9/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */
10/* */
11/* Permission is hereby granted, free of charge, to any person obtaining */
12/* a copy of this software and associated documentation files (the */
13/* "Software"), to deal in the Software without restriction, including */
14/* without limitation the rights to use, copy, modify, merge, publish, */
15/* distribute, sublicense, and/or sell copies of the Software, and to */
16/* permit persons to whom the Software is furnished to do so, subject to */
17/* the following conditions: */
18/* */
19/* The above copyright notice and this permission notice shall be */
20/* included in all copies or substantial portions of the Software. */
21/* */
22/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
23/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
24/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. */
25/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
26/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
27/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
28/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
29/**************************************************************************/
30
31#ifndef SERVER_WRAP_MT_COMMON_H
32#define SERVER_WRAP_MT_COMMON_H
33
34#define FUNC0R(m_r, m_type) \
35 virtual m_r m_type() override { \
36 if (Thread::get_caller_id() != server_thread) { \
37 m_r ret; \
38 command_queue.push_and_ret(server_name, &ServerName::m_type, &ret); \
39 SYNC_DEBUG \
40 return ret; \
41 } else { \
42 command_queue.flush_if_pending(); \
43 return server_name->m_type(); \
44 } \
45 }
46
47#define FUNCRIDSPLIT(m_type) \
48 virtual RID m_type##_create() override { \
49 RID ret = server_name->m_type##_allocate(); \
50 if (Thread::get_caller_id() != server_thread) { \
51 command_queue.push(server_name, &ServerName::m_type##_initialize, ret); \
52 } else { \
53 server_name->m_type##_initialize(ret); \
54 } \
55 return ret; \
56 }
57
58//RID now returns directly, ensure thread safety yourself
59#define FUNCRID(m_type) \
60 virtual RID m_type##_create() override { \
61 return server_name->m_type##_create(); \
62 }
63
64#define FUNC0RC(m_r, m_type) \
65 virtual m_r m_type() const override { \
66 WRITE_ACTION \
67 if (Thread::get_caller_id() != server_thread) { \
68 m_r ret; \
69 command_queue.push_and_ret(server_name, &ServerName::m_type, &ret); \
70 SYNC_DEBUG \
71 return ret; \
72 } else { \
73 command_queue.flush_if_pending(); \
74 return server_name->m_type(); \
75 } \
76 }
77
78#define FUNC0(m_type) \
79 virtual void m_type() override { \
80 WRITE_ACTION \
81 if (Thread::get_caller_id() != server_thread) { \
82 command_queue.push(server_name, &ServerName::m_type); \
83 } else { \
84 command_queue.flush_if_pending(); \
85 server_name->m_type(); \
86 } \
87 }
88
89#define FUNC0C(m_type) \
90 virtual void m_type() const override { \
91 if (Thread::get_caller_id() != server_thread) { \
92 command_queue.push(server_name, &ServerName::m_type); \
93 } else { \
94 command_queue.flush_if_pending(); \
95 server_name->m_type(); \
96 } \
97 }
98
99#define FUNC0S(m_type) \
100 virtual void m_type() override { \
101 WRITE_ACTION \
102 if (Thread::get_caller_id() != server_thread) { \
103 command_queue.push_and_sync(server_name, &ServerName::m_type); \
104 SYNC_DEBUG \
105 } else { \
106 command_queue.flush_if_pending(); \
107 server_name->m_type(); \
108 } \
109 }
110
111#define FUNC0SC(m_type) \
112 virtual void m_type() const override { \
113 if (Thread::get_caller_id() != server_thread) { \
114 command_queue.push_and_sync(server_name, &ServerName::m_type); \
115 SYNC_DEBUG \
116 } else { \
117 command_queue.flush_if_pending(); \
118 server_name->m_type(); \
119 } \
120 }
121
122///////////////////////////////////////////////
123
124#define FUNC1R(m_r, m_type, m_arg1) \
125 virtual m_r m_type(m_arg1 p1) override { \
126 WRITE_ACTION \
127 if (Thread::get_caller_id() != server_thread) { \
128 m_r ret; \
129 command_queue.push_and_ret(server_name, &ServerName::m_type, p1, &ret); \
130 SYNC_DEBUG \
131 return ret; \
132 } else { \
133 command_queue.flush_if_pending(); \
134 return server_name->m_type(p1); \
135 } \
136 }
137
138#define FUNC1RC(m_r, m_type, m_arg1) \
139 virtual m_r m_type(m_arg1 p1) const override { \
140 if (Thread::get_caller_id() != server_thread) { \
141 m_r ret; \
142 command_queue.push_and_ret(server_name, &ServerName::m_type, p1, &ret); \
143 SYNC_DEBUG \
144 return ret; \
145 } else { \
146 command_queue.flush_if_pending(); \
147 return server_name->m_type(p1); \
148 } \
149 }
150
151#define FUNC1S(m_type, m_arg1) \
152 virtual void m_type(m_arg1 p1) override { \
153 WRITE_ACTION \
154 if (Thread::get_caller_id() != server_thread) { \
155 command_queue.push_and_sync(server_name, &ServerName::m_type, p1); \
156 SYNC_DEBUG \
157 } else { \
158 command_queue.flush_if_pending(); \
159 server_name->m_type(p1); \
160 } \
161 }
162
163#define FUNC1SC(m_type, m_arg1) \
164 virtual void m_type(m_arg1 p1) const override { \
165 if (Thread::get_caller_id() != server_thread) { \
166 command_queue.push_and_sync(server_name, &ServerName::m_type, p1); \
167 SYNC_DEBUG \
168 } else { \
169 command_queue.flush_if_pending(); \
170 server_name->m_type(p1); \
171 } \
172 }
173
174#define FUNC1(m_type, m_arg1) \
175 virtual void m_type(m_arg1 p1) override { \
176 WRITE_ACTION \
177 if (Thread::get_caller_id() != server_thread) { \
178 command_queue.push(server_name, &ServerName::m_type, p1); \
179 } else { \
180 command_queue.flush_if_pending(); \
181 server_name->m_type(p1); \
182 } \
183 }
184
185#define FUNC1C(m_type, m_arg1) \
186 virtual void m_type(m_arg1 p1) const override { \
187 if (Thread::get_caller_id() != server_thread) { \
188 command_queue.push(server_name, &ServerName::m_type, p1); \
189 } else { \
190 command_queue.flush_if_pending(); \
191 server_name->m_type(p1); \
192 } \
193 }
194
195#define FUNC2R(m_r, m_type, m_arg1, m_arg2) \
196 virtual m_r m_type(m_arg1 p1, m_arg2 p2) override { \
197 WRITE_ACTION \
198 if (Thread::get_caller_id() != server_thread) { \
199 m_r ret; \
200 command_queue.push_and_ret(server_name, &ServerName::m_type, p1, p2, &ret); \
201 SYNC_DEBUG \
202 return ret; \
203 } else { \
204 command_queue.flush_if_pending(); \
205 return server_name->m_type(p1, p2); \
206 } \
207 }
208
209#define FUNC2RC(m_r, m_type, m_arg1, m_arg2) \
210 virtual m_r m_type(m_arg1 p1, m_arg2 p2) const override { \
211 if (Thread::get_caller_id() != server_thread) { \
212 m_r ret; \
213 command_queue.push_and_ret(server_name, &ServerName::m_type, p1, p2, &ret); \
214 SYNC_DEBUG \
215 return ret; \
216 } else { \
217 command_queue.flush_if_pending(); \
218 return server_name->m_type(p1, p2); \
219 } \
220 }
221
222#define FUNC2S(m_type, m_arg1, m_arg2) \
223 virtual void m_type(m_arg1 p1, m_arg2 p2) override { \
224 WRITE_ACTION \
225 if (Thread::get_caller_id() != server_thread) { \
226 command_queue.push_and_sync(server_name, &ServerName::m_type, p1, p2); \
227 SYNC_DEBUG \
228 } else { \
229 command_queue.flush_if_pending(); \
230 server_name->m_type(p1, p2); \
231 } \
232 }
233
234#define FUNC2SC(m_type, m_arg1, m_arg2) \
235 virtual void m_type(m_arg1 p1, m_arg2 p2) const override { \
236 if (Thread::get_caller_id() != server_thread) { \
237 command_queue.push_and_sync(server_name, &ServerName::m_type, p1, p2); \
238 SYNC_DEBUG \
239 } else { \
240 command_queue.flush_if_pending(); \
241 server_name->m_type(p1, p2); \
242 } \
243 }
244
245#define FUNC2(m_type, m_arg1, m_arg2) \
246 virtual void m_type(m_arg1 p1, m_arg2 p2) override { \
247 WRITE_ACTION \
248 if (Thread::get_caller_id() != server_thread) { \
249 command_queue.push(server_name, &ServerName::m_type, p1, p2); \
250 } else { \
251 command_queue.flush_if_pending(); \
252 server_name->m_type(p1, p2); \
253 } \
254 }
255
256#define FUNC2C(m_type, m_arg1, m_arg2) \
257 virtual void m_type(m_arg1 p1, m_arg2 p2) const override { \
258 if (Thread::get_caller_id() != server_thread) { \
259 command_queue.push(server_name, &ServerName::m_type, p1, p2); \
260 } else { \
261 command_queue.flush_if_pending(); \
262 server_name->m_type(p1, p2); \
263 } \
264 }
265
266#define FUNC3R(m_r, m_type, m_arg1, m_arg2, m_arg3) \
267 virtual m_r m_type(m_arg1 p1, m_arg2 p2, m_arg3 p3) override { \
268 WRITE_ACTION \
269 if (Thread::get_caller_id() != server_thread) { \
270 m_r ret; \
271 command_queue.push_and_ret(server_name, &ServerName::m_type, p1, p2, p3, &ret); \
272 SYNC_DEBUG \
273 return ret; \
274 } else { \
275 command_queue.flush_if_pending(); \
276 return server_name->m_type(p1, p2, p3); \
277 } \
278 }
279
280#define FUNC3RC(m_r, m_type, m_arg1, m_arg2, m_arg3) \
281 virtual m_r m_type(m_arg1 p1, m_arg2 p2, m_arg3 p3) const override { \
282 if (Thread::get_caller_id() != server_thread) { \
283 m_r ret; \
284 command_queue.push_and_ret(server_name, &ServerName::m_type, p1, p2, p3, &ret); \
285 SYNC_DEBUG \
286 return ret; \
287 } else { \
288 command_queue.flush_if_pending(); \
289 return server_name->m_type(p1, p2, p3); \
290 } \
291 }
292
293#define FUNC3S(m_type, m_arg1, m_arg2, m_arg3) \
294 virtual void m_type(m_arg1 p1, m_arg2 p2, m_arg3 p3) override { \
295 WRITE_ACTION \
296 if (Thread::get_caller_id() != server_thread) { \
297 command_queue.push_and_sync(server_name, &ServerName::m_type, p1, p2, p3); \
298 SYNC_DEBUG \
299 } else { \
300 command_queue.flush_if_pending(); \
301 server_name->m_type(p1, p2, p3); \
302 } \
303 }
304
305#define FUNC3SC(m_type, m_arg1, m_arg2, m_arg3) \
306 virtual void m_type(m_arg1 p1, m_arg2 p2, m_arg3 p3) const override { \
307 if (Thread::get_caller_id() != server_thread) { \
308 command_queue.push_and_sync(server_name, &ServerName::m_type, p1, p2, p3); \
309 SYNC_DEBUG \
310 } else { \
311 command_queue.flush_if_pending(); \
312 server_name->m_type(p1, p2, p3); \
313 } \
314 }
315
316#define FUNC3(m_type, m_arg1, m_arg2, m_arg3) \
317 virtual void m_type(m_arg1 p1, m_arg2 p2, m_arg3 p3) override { \
318 WRITE_ACTION \
319 if (Thread::get_caller_id() != server_thread) { \
320 command_queue.push(server_name, &ServerName::m_type, p1, p2, p3); \
321 } else { \
322 command_queue.flush_if_pending(); \
323 server_name->m_type(p1, p2, p3); \
324 } \
325 }
326
327#define FUNC3C(m_type, m_arg1, m_arg2, m_arg3) \
328 virtual void m_type(m_arg1 p1, m_arg2 p2, m_arg3 p3) const override { \
329 if (Thread::get_caller_id() != server_thread) { \
330 command_queue.push(server_name, &ServerName::m_type, p1, p2, p3); \
331 } else { \
332 command_queue.flush_if_pending(); \
333 server_name->m_type(p1, p2, p3); \
334 } \
335 }
336
337#define FUNC4R(m_r, m_type, m_arg1, m_arg2, m_arg3, m_arg4) \
338 virtual m_r m_type(m_arg1 p1, m_arg2 p2, m_arg3 p3, m_arg4 p4) override { \
339 WRITE_ACTION \
340 if (Thread::get_caller_id() != server_thread) { \
341 m_r ret; \
342 command_queue.push_and_ret(server_name, &ServerName::m_type, p1, p2, p3, p4, &ret); \
343 SYNC_DEBUG \
344 return ret; \
345 } else { \
346 command_queue.flush_if_pending(); \
347 return server_name->m_type(p1, p2, p3, p4); \
348 } \
349 }
350
351#define FUNC4RC(m_r, m_type, m_arg1, m_arg2, m_arg3, m_arg4) \
352 virtual m_r m_type(m_arg1 p1, m_arg2 p2, m_arg3 p3, m_arg4 p4) const override { \
353 if (Thread::get_caller_id() != server_thread) { \
354 m_r ret; \
355 command_queue.push_and_ret(server_name, &ServerName::m_type, p1, p2, p3, p4, &ret); \
356 SYNC_DEBUG \
357 return ret; \
358 } else { \
359 command_queue.flush_if_pending(); \
360 return server_name->m_type(p1, p2, p3, p4); \
361 } \
362 }
363
364#define FUNC4S(m_type, m_arg1, m_arg2, m_arg3, m_arg4) \
365 virtual void m_type(m_arg1 p1, m_arg2 p2, m_arg3 p3, m_arg4 p4) override { \
366 WRITE_ACTION \
367 if (Thread::get_caller_id() != server_thread) { \
368 command_queue.push_and_sync(server_name, &ServerName::m_type, p1, p2, p3, p4); \
369 SYNC_DEBUG \
370 } else { \
371 command_queue.flush_if_pending(); \
372 server_name->m_type(p1, p2, p3, p4); \
373 } \
374 }
375
376#define FUNC4SC(m_type, m_arg1, m_arg2, m_arg3, m_arg4) \
377 virtual void m_type(m_arg1 p1, m_arg2 p2, m_arg3 p3, m_arg4 p4) const override { \
378 if (Thread::get_caller_id() != server_thread) { \
379 command_queue.push_and_sync(server_name, &ServerName::m_type, p1, p2, p3, p4); \
380 SYNC_DEBUG \
381 } else { \
382 command_queue.flush_if_pending(); \
383 server_name->m_type(p1, p2, p3, p4); \
384 } \
385 }
386
387#define FUNC4(m_type, m_arg1, m_arg2, m_arg3, m_arg4) \
388 virtual void m_type(m_arg1 p1, m_arg2 p2, m_arg3 p3, m_arg4 p4) override { \
389 WRITE_ACTION \
390 if (Thread::get_caller_id() != server_thread) { \
391 command_queue.push(server_name, &ServerName::m_type, p1, p2, p3, p4); \
392 } else { \
393 command_queue.flush_if_pending(); \
394 server_name->m_type(p1, p2, p3, p4); \
395 } \
396 }
397
398#define FUNC4C(m_type, m_arg1, m_arg2, m_arg3, m_arg4) \
399 virtual void m_type(m_arg1 p1, m_arg2 p2, m_arg3 p3, m_arg4 p4) const override { \
400 if (Thread::get_caller_id() != server_thread) { \
401 command_queue.push(server_name, &ServerName::m_type, p1, p2, p3, p4); \
402 } else { \
403 command_queue.flush_if_pending(); \
404 server_name->m_type(p1, p2, p3, p4); \
405 } \
406 }
407
408#define FUNC5R(m_r, m_type, m_arg1, m_arg2, m_arg3, m_arg4, m_arg5) \
409 virtual m_r m_type(m_arg1 p1, m_arg2 p2, m_arg3 p3, m_arg4 p4, m_arg5 p5) { \
410 WRITE_ACTION \
411 if (Thread::get_caller_id() != server_thread) { \
412 m_r ret; \
413 command_queue.push_and_ret(server_name, &ServerName::m_type, p1, p2, p3, p4, p5, &ret); \
414 SYNC_DEBUG \
415 return ret; \
416 } else { \
417 command_queue.flush_if_pending(); \
418 return server_name->m_type(p1, p2, p3, p4, p5); \
419 } \
420 }
421
422#define FUNC5RC(m_r, m_type, m_arg1, m_arg2, m_arg3, m_arg4, m_arg5) \
423 virtual m_r m_type(m_arg1 p1, m_arg2 p2, m_arg3 p3, m_arg4 p4, m_arg5 p5) const override { \
424 if (Thread::get_caller_id() != server_thread) { \
425 m_r ret; \
426 command_queue.push_and_ret(server_name, &ServerName::m_type, p1, p2, p3, p4, p5, &ret); \
427 SYNC_DEBUG \
428 return ret; \
429 } else { \
430 command_queue.flush_if_pending(); \
431 return server_name->m_type(p1, p2, p3, p4, p5); \
432 } \
433 }
434
435#define FUNC5S(m_type, m_arg1, m_arg2, m_arg3, m_arg4, m_arg5) \
436 virtual void m_type(m_arg1 p1, m_arg2 p2, m_arg3 p3, m_arg4 p4, m_arg5 p5) override { \
437 WRITE_ACTION \
438 if (Thread::get_caller_id() != server_thread) { \
439 command_queue.push_and_sync(server_name, &ServerName::m_type, p1, p2, p3, p4, p5); \
440 SYNC_DEBUG \
441 } else { \
442 command_queue.flush_if_pending(); \
443 server_name->m_type(p1, p2, p3, p4, p5); \
444 } \
445 }
446
447#define FUNC5SC(m_type, m_arg1, m_arg2, m_arg3, m_arg4, m_arg5) \
448 virtual void m_type(m_arg1 p1, m_arg2 p2, m_arg3 p3, m_arg4 p4, m_arg5 p5) const override { \
449 if (Thread::get_caller_id() != server_thread) { \
450 command_queue.push_and_sync(server_name, &ServerName::m_type, p1, p2, p3, p4, p5); \
451 SYNC_DEBUG \
452 } else { \
453 command_queue.flush_if_pending(); \
454 server_name->m_type(p1, p2, p3, p4, p5); \
455 } \
456 }
457
458#define FUNC5(m_type, m_arg1, m_arg2, m_arg3, m_arg4, m_arg5) \
459 virtual void m_type(m_arg1 p1, m_arg2 p2, m_arg3 p3, m_arg4 p4, m_arg5 p5) override { \
460 WRITE_ACTION \
461 if (Thread::get_caller_id() != server_thread) { \
462 command_queue.push(server_name, &ServerName::m_type, p1, p2, p3, p4, p5); \
463 } else { \
464 command_queue.flush_if_pending(); \
465 server_name->m_type(p1, p2, p3, p4, p5); \
466 } \
467 }
468
469#define FUNC5C(m_type, m_arg1, m_arg2, m_arg3, m_arg4, m_arg5) \
470 virtual void m_type(m_arg1 p1, m_arg2 p2, m_arg3 p3, m_arg4 p4, m_arg5 p5) const override { \
471 if (Thread::get_caller_id() != server_thread) { \
472 command_queue.push(server_name, &ServerName::m_type, p1, p2, p3, p4, p5); \
473 } else { \
474 command_queue.flush_if_pending(); \
475 server_name->m_type(p1, p2, p3, p4, p5); \
476 } \
477 }
478
479#define FUNC6R(m_r, m_type, m_arg1, m_arg2, m_arg3, m_arg4, m_arg5, m_arg6) \
480 virtual m_r m_type(m_arg1 p1, m_arg2 p2, m_arg3 p3, m_arg4 p4, m_arg5 p5, m_arg6 p6) { \
481 WRITE_ACTION \
482 if (Thread::get_caller_id() != server_thread) { \
483 m_r ret; \
484 command_queue.push_and_ret(server_name, &ServerName::m_type, p1, p2, p3, p4, p5, p6, &ret); \
485 SYNC_DEBUG \
486 return ret; \
487 } else { \
488 command_queue.flush_if_pending(); \
489 return server_name->m_type(p1, p2, p3, p4, p5, p6); \
490 } \
491 }
492
493#define FUNC6RC(m_r, m_type, m_arg1, m_arg2, m_arg3, m_arg4, m_arg5, m_arg6) \
494 virtual m_r m_type(m_arg1 p1, m_arg2 p2, m_arg3 p3, m_arg4 p4, m_arg5 p5, m_arg6 p6) const override { \
495 if (Thread::get_caller_id() != server_thread) { \
496 m_r ret; \
497 command_queue.push_and_ret(server_name, &ServerName::m_type, p1, p2, p3, p4, p5, p6, &ret); \
498 SYNC_DEBUG \
499 return ret; \
500 } else { \
501 command_queue.flush_if_pending(); \
502 return server_name->m_type(p1, p2, p3, p4, p5, p6); \
503 } \
504 }
505
506#define FUNC6S(m_type, m_arg1, m_arg2, m_arg3, m_arg4, m_arg5, m_arg6) \
507 virtual void m_type(m_arg1 p1, m_arg2 p2, m_arg3 p3, m_arg4 p4, m_arg5 p5, m_arg6 p6) override { \
508 WRITE_ACTION \
509 if (Thread::get_caller_id() != server_thread) { \
510 command_queue.push_and_sync(server_name, &ServerName::m_type, p1, p2, p3, p4, p5, p6); \
511 SYNC_DEBUG \
512 } else { \
513 command_queue.flush_if_pending(); \
514 server_name->m_type(p1, p2, p3, p4, p5, p6); \
515 } \
516 }
517
518#define FUNC6SC(m_type, m_arg1, m_arg2, m_arg3, m_arg4, m_arg5, m_arg6) \
519 virtual void m_type(m_arg1 p1, m_arg2 p2, m_arg3 p3, m_arg4 p4, m_arg5 p5, m_arg6 p6) const override { \
520 if (Thread::get_caller_id() != server_thread) { \
521 command_queue.push_and_sync(server_name, &ServerName::m_type, p1, p2, p3, p4, p5, p6); \
522 SYNC_DEBUG \
523 } else { \
524 command_queue.flush_if_pending(); \
525 server_name->m_type(p1, p2, p3, p4, p5, p6); \
526 } \
527 }
528
529#define FUNC6(m_type, m_arg1, m_arg2, m_arg3, m_arg4, m_arg5, m_arg6) \
530 virtual void m_type(m_arg1 p1, m_arg2 p2, m_arg3 p3, m_arg4 p4, m_arg5 p5, m_arg6 p6) override { \
531 WRITE_ACTION \
532 if (Thread::get_caller_id() != server_thread) { \
533 command_queue.push(server_name, &ServerName::m_type, p1, p2, p3, p4, p5, p6); \
534 } else { \
535 command_queue.flush_if_pending(); \
536 server_name->m_type(p1, p2, p3, p4, p5, p6); \
537 } \
538 }
539
540#define FUNC6C(m_type, m_arg1, m_arg2, m_arg3, m_arg4, m_arg5, m_arg6) \
541 virtual void m_type(m_arg1 p1, m_arg2 p2, m_arg3 p3, m_arg4 p4, m_arg5 p5, m_arg6 p6) const override { \
542 if (Thread::get_caller_id() != server_thread) { \
543 command_queue.push(server_name, &ServerName::m_type, p1, p2, p3, p4, p5, p6); \
544 } else { \
545 command_queue.flush_if_pending(); \
546 server_name->m_type(p1, p2, p3, p4, p5, p6); \
547 } \
548 }
549
550#define FUNC7R(m_r, m_type, m_arg1, m_arg2, m_arg3, m_arg4, m_arg5, m_arg6, m_arg7) \
551 virtual m_r m_type(m_arg1 p1, m_arg2 p2, m_arg3 p3, m_arg4 p4, m_arg5 p5, m_arg6 p6, m_arg7 p7) override { \
552 WRITE_ACTION \
553 if (Thread::get_caller_id() != server_thread) { \
554 m_r ret; \
555 command_queue.push_and_ret(server_name, &ServerName::m_type, p1, p2, p3, p4, p5, p6, p7, &ret); \
556 SYNC_DEBUG \
557 return ret; \
558 } else { \
559 command_queue.flush_if_pending(); \
560 return server_name->m_type(p1, p2, p3, p4, p5, p6, p7); \
561 } \
562 }
563
564#define FUNC7RC(m_r, m_type, m_arg1, m_arg2, m_arg3, m_arg4, m_arg5, m_arg6, m_arg7) \
565 virtual m_r m_type(m_arg1 p1, m_arg2 p2, m_arg3 p3, m_arg4 p4, m_arg5 p5, m_arg6 p6, m_arg7 p7) const override { \
566 if (Thread::get_caller_id() != server_thread) { \
567 m_r ret; \
568 command_queue.push_and_ret(server_name, &ServerName::m_type, p1, p2, p3, p4, p5, p6, p7, &ret); \
569 SYNC_DEBUG \
570 return ret; \
571 } else { \
572 command_queue.flush_if_pending(); \
573 return server_name->m_type(p1, p2, p3, p4, p5, p6, p7); \
574 } \
575 }
576
577#define FUNC7S(m_type, m_arg1, m_arg2, m_arg3, m_arg4, m_arg5, m_arg6, m_arg7) \
578 virtual void m_type(m_arg1 p1, m_arg2 p2, m_arg3 p3, m_arg4 p4, m_arg5 p5, m_arg6 p6, m_arg7 p7) override { \
579 WRITE_ACTION \
580 if (Thread::get_caller_id() != server_thread) { \
581 command_queue.push_and_sync(server_name, &ServerName::m_type, p1, p2, p3, p4, p5, p6, p7); \
582 SYNC_DEBUG \
583 } else { \
584 command_queue.flush_if_pending(); \
585 server_name->m_type(p1, p2, p3, p4, p5, p6, p7); \
586 } \
587 }
588
589#define FUNC7SC(m_type, m_arg1, m_arg2, m_arg3, m_arg4, m_arg5, m_arg6, m_arg7) \
590 virtual void m_type(m_arg1 p1, m_arg2 p2, m_arg3 p3, m_arg4 p4, m_arg5 p5, m_arg6 p6, m_arg7 p7) const override { \
591 if (Thread::get_caller_id() != server_thread) { \
592 command_queue.push_and_sync(server_name, &ServerName::m_type, p1, p2, p3, p4, p5, p6, p7); \
593 SYNC_DEBUG \
594 } else { \
595 command_queue.flush_if_pending(); \
596 server_name->m_type(p1, p2, p3, p4, p5, p6, p7); \
597 } \
598 }
599
600#define FUNC7(m_type, m_arg1, m_arg2, m_arg3, m_arg4, m_arg5, m_arg6, m_arg7) \
601 virtual void m_type(m_arg1 p1, m_arg2 p2, m_arg3 p3, m_arg4 p4, m_arg5 p5, m_arg6 p6, m_arg7 p7) override { \
602 WRITE_ACTION \
603 if (Thread::get_caller_id() != server_thread) { \
604 command_queue.push(server_name, &ServerName::m_type, p1, p2, p3, p4, p5, p6, p7); \
605 } else { \
606 command_queue.flush_if_pending(); \
607 server_name->m_type(p1, p2, p3, p4, p5, p6, p7); \
608 } \
609 }
610
611#define FUNC7C(m_type, m_arg1, m_arg2, m_arg3, m_arg4, m_arg5, m_arg6, m_arg7) \
612 virtual void m_type(m_arg1 p1, m_arg2 p2, m_arg3 p3, m_arg4 p4, m_arg5 p5, m_arg6 p6, m_arg7 p7) const override { \
613 if (Thread::get_caller_id() != server_thread) { \
614 command_queue.push(server_name, &ServerName::m_type, p1, p2, p3, p4, p5, p6, p7); \
615 } else { \
616 command_queue.flush_if_pending(); \
617 server_name->m_type(p1, p2, p3, p4, p5, p6, p7); \
618 } \
619 }
620
621#define FUNC8R(m_r, m_type, m_arg1, m_arg2, m_arg3, m_arg4, m_arg5, m_arg6, m_arg7, m_arg8) \
622 virtual m_r m_type(m_arg1 p1, m_arg2 p2, m_arg3 p3, m_arg4 p4, m_arg5 p5, m_arg6 p6, m_arg7 p7, m_arg8 p8) override { \
623 WRITE_ACTION \
624 if (Thread::get_caller_id() != server_thread) { \
625 m_r ret; \
626 command_queue.push_and_ret(server_name, &ServerName::m_type, p1, p2, p3, p4, p5, p6, p7, p8, &ret); \
627 SYNC_DEBUG \
628 return ret; \
629 } else { \
630 command_queue.flush_if_pending(); \
631 return server_name->m_type(p1, p2, p3, p4, p5, p6, p7, p8); \
632 } \
633 }
634
635#define FUNC8RC(m_r, m_type, m_arg1, m_arg2, m_arg3, m_arg4, m_arg5, m_arg6, m_arg7, m_arg8) \
636 virtual m_r m_type(m_arg1 p1, m_arg2 p2, m_arg3 p3, m_arg4 p4, m_arg5 p5, m_arg6 p6, m_arg7 p7, m_arg8 p8) const override { \
637 if (Thread::get_caller_id() != server_thread) { \
638 m_r ret; \
639 command_queue.push_and_ret(server_name, &ServerName::m_type, p1, p2, p3, p4, p5, p6, p7, p8, &ret); \
640 SYNC_DEBUG \
641 return ret; \
642 } else { \
643 command_queue.flush_if_pending(); \
644 return server_name->m_type(p1, p2, p3, p4, p5, p6, p7, p8); \
645 } \
646 }
647
648#define FUNC8S(m_type, m_arg1, m_arg2, m_arg3, m_arg4, m_arg5, m_arg6, m_arg7, m_arg8) \
649 virtual void m_type(m_arg1 p1, m_arg2 p2, m_arg3 p3, m_arg4 p4, m_arg5 p5, m_arg6 p6, m_arg7 p7, m_arg8 p8) override { \
650 WRITE_ACTION \
651 if (Thread::get_caller_id() != server_thread) { \
652 command_queue.push_and_sync(server_name, &ServerName::m_type, p1, p2, p3, p4, p5, p6, p7, p8); \
653 SYNC_DEBUG \
654 } else { \
655 command_queue.flush_if_pending(); \
656 server_name->m_type(p1, p2, p3, p4, p5, p6, p7, p8); \
657 } \
658 }
659
660#define FUNC8SC(m_type, m_arg1, m_arg2, m_arg3, m_arg4, m_arg5, m_arg6, m_arg7, m_arg8) \
661 virtual void m_type(m_arg1 p1, m_arg2 p2, m_arg3 p3, m_arg4 p4, m_arg5 p5, m_arg6 p6, m_arg7 p7, m_arg8 p8) const override { \
662 if (Thread::get_caller_id() != server_thread) { \
663 command_queue.push_and_sync(server_name, &ServerName::m_type, p1, p2, p3, p4, p5, p6, p7, p8); \
664 SYNC_DEBUG \
665 } else { \
666 command_queue.flush_if_pending(); \
667 server_name->m_type(p1, p2, p3, p4, p5, p6, p7, p8); \
668 } \
669 }
670
671#define FUNC8(m_type, m_arg1, m_arg2, m_arg3, m_arg4, m_arg5, m_arg6, m_arg7, m_arg8) \
672 virtual void m_type(m_arg1 p1, m_arg2 p2, m_arg3 p3, m_arg4 p4, m_arg5 p5, m_arg6 p6, m_arg7 p7, m_arg8 p8) override { \
673 WRITE_ACTION \
674 if (Thread::get_caller_id() != server_thread) { \
675 command_queue.push(server_name, &ServerName::m_type, p1, p2, p3, p4, p5, p6, p7, p8); \
676 } else { \
677 command_queue.flush_if_pending(); \
678 server_name->m_type(p1, p2, p3, p4, p5, p6, p7, p8); \
679 } \
680 }
681
682#define FUNC8C(m_type, m_arg1, m_arg2, m_arg3, m_arg4, m_arg5, m_arg6, m_arg7, m_arg8) \
683 virtual void m_type(m_arg1 p1, m_arg2 p2, m_arg3 p3, m_arg4 p4, m_arg5 p5, m_arg6 p6, m_arg7 p7, m_arg8 p8) const override { \
684 if (Thread::get_caller_id() != server_thread) { \
685 command_queue.push(server_name, &ServerName::m_type, p1, p2, p3, p4, p5, p6, p7, p8); \
686 } else { \
687 command_queue.flush_if_pending(); \
688 server_name->m_type(p1, p2, p3, p4, p5, p6, p7, p8); \
689 } \
690 }
691
692#define FUNC9(m_type, m_arg1, m_arg2, m_arg3, m_arg4, m_arg5, m_arg6, m_arg7, m_arg8, m_arg9) \
693 virtual void m_type(m_arg1 p1, m_arg2 p2, m_arg3 p3, m_arg4 p4, m_arg5 p5, m_arg6 p6, m_arg7 p7, m_arg8 p8, m_arg9 p9) override { \
694 WRITE_ACTION \
695 if (Thread::get_caller_id() != server_thread) { \
696 command_queue.push(server_name, &ServerName::m_type, p1, p2, p3, p4, p5, p6, p7, p8, p9); \
697 } else { \
698 command_queue.flush_if_pending(); \
699 server_name->m_type(p1, p2, p3, p4, p5, p6, p7, p8, p9); \
700 } \
701 }
702
703#define FUNC10(m_type, m_arg1, m_arg2, m_arg3, m_arg4, m_arg5, m_arg6, m_arg7, m_arg8, m_arg9, m_arg10) \
704 virtual void m_type(m_arg1 p1, m_arg2 p2, m_arg3 p3, m_arg4 p4, m_arg5 p5, m_arg6 p6, m_arg7 p7, m_arg8 p8, m_arg9 p9, m_arg10 p10) override { \
705 WRITE_ACTION \
706 if (Thread::get_caller_id() != server_thread) { \
707 command_queue.push(server_name, &ServerName::m_type, p1, p2, p3, p4, p5, p6, p7, p8, p9, p10); \
708 } else { \
709 command_queue.flush_if_pending(); \
710 server_name->m_type(p1, p2, p3, p4, p5, p6, p7, p8, p9, p10); \
711 } \
712 }
713
714#define FUNC11(m_type, m_arg1, m_arg2, m_arg3, m_arg4, m_arg5, m_arg6, m_arg7, m_arg8, m_arg9, m_arg10, m_arg11) \
715 virtual void m_type(m_arg1 p1, m_arg2 p2, m_arg3 p3, m_arg4 p4, m_arg5 p5, m_arg6 p6, m_arg7 p7, m_arg8 p8, m_arg9 p9, m_arg10 p10, m_arg11 p11) override { \
716 WRITE_ACTION \
717 if (Thread::get_caller_id() != server_thread) { \
718 command_queue.push(server_name, &ServerName::m_type, p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11); \
719 } else { \
720 command_queue.flush_if_pending(); \
721 server_name->m_type(p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11); \
722 } \
723 }
724
725#define FUNC12(m_type, m_arg1, m_arg2, m_arg3, m_arg4, m_arg5, m_arg6, m_arg7, m_arg8, m_arg9, m_arg10, m_arg11, m_arg12) \
726 virtual void m_type(m_arg1 p1, m_arg2 p2, m_arg3 p3, m_arg4 p4, m_arg5 p5, m_arg6 p6, m_arg7 p7, m_arg8 p8, m_arg9 p9, m_arg10 p10, m_arg11 p11, m_arg12 p12) override { \
727 WRITE_ACTION \
728 if (Thread::get_caller_id() != server_thread) { \
729 command_queue.push(server_name, &ServerName::m_type, p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12); \
730 } else { \
731 command_queue.flush_if_pending(); \
732 server_name->m_type(p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12); \
733 } \
734 }
735
736#define FUNC13(m_type, m_arg1, m_arg2, m_arg3, m_arg4, m_arg5, m_arg6, m_arg7, m_arg8, m_arg9, m_arg10, m_arg11, m_arg12, m_arg13) \
737 virtual void m_type(m_arg1 p1, m_arg2 p2, m_arg3 p3, m_arg4 p4, m_arg5 p5, m_arg6 p6, m_arg7 p7, m_arg8 p8, m_arg9 p9, m_arg10 p10, m_arg11 p11, m_arg12 p12, m_arg13 p13) override { \
738 WRITE_ACTION \
739 if (Thread::get_caller_id() != server_thread) { \
740 command_queue.push(server_name, &ServerName::m_type, p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12, p13); \
741 } else { \
742 command_queue.flush_if_pending(); \
743 server_name->m_type(p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12, p13); \
744 } \
745 }
746
747#define FUNC14(m_type, m_arg1, m_arg2, m_arg3, m_arg4, m_arg5, m_arg6, m_arg7, m_arg8, m_arg9, m_arg10, m_arg11, m_arg12, m_arg13, m_arg14) \
748 virtual void m_type(m_arg1 p1, m_arg2 p2, m_arg3 p3, m_arg4 p4, m_arg5 p5, m_arg6 p6, m_arg7 p7, m_arg8 p8, m_arg9 p9, m_arg10 p10, m_arg11 p11, m_arg12 p12, m_arg13 p13, m_arg14 p14) override { \
749 WRITE_ACTION \
750 if (Thread::get_caller_id() != server_thread) { \
751 command_queue.push(server_name, &ServerName::m_type, p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12, p13, p14); \
752 } else { \
753 command_queue.flush_if_pending(); \
754 server_name->m_type(p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12, p13, p14); \
755 } \
756 }
757
758#define FUNC15(m_type, m_arg1, m_arg2, m_arg3, m_arg4, m_arg5, m_arg6, m_arg7, m_arg8, m_arg9, m_arg10, m_arg11, m_arg12, m_arg13, m_arg14, m_arg15) \
759 virtual void m_type(m_arg1 p1, m_arg2 p2, m_arg3 p3, m_arg4 p4, m_arg5 p5, m_arg6 p6, m_arg7 p7, m_arg8 p8, m_arg9 p9, m_arg10 p10, m_arg11 p11, m_arg12 p12, m_arg13 p13, m_arg14 p14, m_arg15 p15) override { \
760 WRITE_ACTION \
761 if (Thread::get_caller_id() != server_thread) { \
762 command_queue.push(server_name, &ServerName::m_type, p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12, p13, p14, p15); \
763 } else { \
764 command_queue.flush_if_pending(); \
765 server_name->m_type(p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12, p13, p14, p15); \
766 } \
767 }
768
769#endif // SERVER_WRAP_MT_COMMON_H
770