acme
Foundational cross-platform layer of the ca2 framework
Loading...
Searching...
No Matches
signal.h
1// Created by camilo on 2024-06-11 05:31 <3ThomasBorregaardSorensen!!
2#pragma once
3
4
5template < prototype_function FUNCTION >
6class add_signal_function_to_holder
7{
8public:
9
10 ::data::signal < FUNCTION > * m_psignal;
11 ::object * m_pobjectFunctionHolder;
12 add_signal_function_to_holder(::data::signal < FUNCTION > & signal, ::object * pobjectFunctionHolder) :
13 m_psignal(&signal), m_pobjectFunctionHolder(pobjectFunctionHolder)
14 {
15
16 }
17
18 add_signal_function_to_holder & operator += (const FUNCTION & f);
19
20};
21
22
23namespace data
24{
25
26
27 template < prototype_function FUNCTION >
28 class signal
29 {
30 public:
31
32
33 ::comparable_array < FUNCTION > m_functiona;
34
35
36 signal & operator +=(const FUNCTION & function) { m_functiona += function; return *this; }
37 signal & operator -=(const FUNCTION & function) { m_functiona -= function; return *this; }
38
39
40 };
41
42
43} // namespace data
44
45CLASS_DECL_ACME ::i64 function_debugging_serial();
46template < prototype_function FUNCTION >
47void object::hold_signal_function(::data::signal<FUNCTION> * psignal, const FUNCTION & function)
48{
49
50 this->destroyinga() += [psignal, function]()
51 {
52
53 (*psignal) -= function;
54
55 };
56#if FUNCTION_DEBUGGING
57 this->destroyinga().last().m_pszDebug = "hold signal function";
58 this->destroyinga().last().m_iDebug = function_debugging_serial();
59#endif
60
61}
62
63
64template < prototype_function FUNCTION >
66{
67
68 (*m_psignal) += f;
69
70 m_pobjectFunctionHolder->hold_signal_function(m_psignal, f);
71
72 return *this;
73
74}
75
76
77
Definition signal.h:7
Definition signal.h:29
Definition _template_forward_declaration.h:297
Definition bbb_object.h:11