acme
Foundational cross-platform layer of the ca2 framework
Loading...
Searching...
No Matches
asynchronous.h
1// Created by camilo on 2022-10-14 20:32 <3ThomasBorregaardSorensen
2#pragma once
3
4
5//#include "acme/prototype/prototype/function.h"
6//#include "acme/prototype/prototype/matter.h"
7
8
9template < typename POSTING_OBJECT, typename POSTING_METHOD, typename OBJECT_POINTER, typename OBJECT_METHOD >
10bool __matter_get_posted_payload_synchronously(matter * phandler, POSTING_OBJECT pposting, POSTING_METHOD posting_method, OBJECT_POINTER preturning, OBJECT_METHOD returning_method, ::payload & payload, const class time & timeWait)
11{
12
13 if(pposting->is_branch_current())
14 {
15
16 payload = (preturning->*returning_method)();
17
18 return true;
19
20 }
21
22 auto posting = [pposting, posting_method](const ::procedure & procedure)
23 {
24
25 (pposting->*posting_method)(procedure);
26
27 };
28
29 ::function < void(const ::procedure &) > functionPost(posting);
30
31 ::function < ::payload() > functionReturn([preturning, returning_method]()
32 {
33
34 return (preturning->*returning_method)();
35
36 });
37
38 functionReturn.set_timeout(timeWait);
39
40 return phandler->__get_posted_payload_synchronously(functionPost, functionReturn, payload);
41
42}
43
44
45template < typename POSTING_OBJECT >
46void __matter_send_procedure(matter * phandler, POSTING_OBJECT pposting, void(non_pointer <POSTING_OBJECT>:: *posting_method)(const ::procedure &), const ::procedure & procedure)
47{
48
49 if(pposting->is_branch_current())
50 {
51
52 return procedure();
53
54 }
55
56 auto posting = [pposting, posting_method](const ::procedure & procedure)
57 {
58
59 (pposting->*posting_method)(procedure);
60
61 };
62
63 phandler->__send_procedure(posting, procedure);
64
65}
66
67
68
Definition _template_forward_declaration.h:297
Definition matter.h:17
Definition payload.h:54
Definition aaa_time.h:13