acme
Foundational cross-platform layer of the ca2 framework
Toggle main menu visibility
Loading...
Searching...
No Matches
signal.h
1
// Created by camilo on 2024-06-11 05:31 <3ThomasBorregaardSorensen!!
2
#pragma once
3
4
5
template
< prototype_function FUNCTION >
6
class
add_signal_function_to_holder
7
{
8
public
:
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
23
namespace
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
45
CLASS_DECL_ACME ::i64 function_debugging_serial();
46
template
< prototype_function FUNCTION >
47
void
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
64
template
< prototype_function FUNCTION >
65
add_signal_function_to_holder<FUNCTION>
&
add_signal_function_to_holder<FUNCTION>::operator +=
(
const
FUNCTION & f)
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
add_signal_function_to_holder
Definition
signal.h:7
data::signal
Definition
signal.h:29
function
Definition
_template_forward_declaration.h:297
object
Definition
bbb_object.h:11
prototype
data
signal.h
Generated by
1.17.0