2
3
4
5
6
7
8
9
10
11
13#ifndef GIMBAL_SIGNAL_H
14#define GIMBAL_SIGNAL_H
16#include "../types/gimbal_type.h"
17#include "../../core/gimbal_typedefs.h"
18#include "../../preprocessor/gimbal_macro_composition.h"
21#define GBL_SIGNALS(instanceStruct, ...)
22#define GBL_SIGNALS_REGISTER(instanceStruct, ...)
23#define GBL_EMIT(emitter, ...) (GblSignal_emit(GBL_INSTANCE(emitter), __VA_ARGS__))
30 GblMarshalFn pFnCMarshal,
39GBL_EXPORT GBL_RESULT GblSignal_connect (GblInstance* pEmitter,
40 const char* pSignalName,
41 GblInstance* pReceiver,
45GBL_EXPORT GBL_RESULT GblSignal_connectClass (GblInstance* pEmitter,
46 const char* pSignalName,
47 GblInstance* pReceiver,
51GBL_EXPORT GBL_RESULT GblSignal_connectSignal (GblInstance* pEmitter,
52 const char* pSignalName,
53 GblInstance* pDstEmitter,
56GBL_EXPORT GBL_RESULT GblSignal_connectClosure (GblInstance* pEmitter,
57 const char* pSignalName,
58 GblInstance* pReceiver,
61GBL_EXPORT size_t GblSignal_disconnect (GblInstance* pEmitter,
62 const char* pSignalName,
63 GblInstance* pReceiver,
67 const char* pSignalName,
73GBL_EXPORT size_t GblSignal_connectionCount (GblInstance* pInstance,
76GBL_EXPORT GBL_RESULT GblSignal_emit (GblInstance* pEmitter,
77 const char* pSignalName,
80GBL_EXPORT GBL_RESULT GblSignal_emitVaList (GblInstance* pEmitter,
81 const char* pSignalName,
84GBL_EXPORT GBL_RESULT GblSignal_emitVariants (GblInstance* pEmitter,
85 const char* pSignalName,
97#define GblSignal_connect_3(emitter, signal, callback)
98 (GblSignal_connect_4
(emitter, signal, emitter, callback))
99#define GblSignal_connect_4(emitter, signal, receiver, callback)
100 (GblSignal_connect_5
(emitter, signal, receiver, callback, GBL_NULL))
101#define GblSignal_connect_5(emitter, signal, receiver, callback, userdata)
104#define GBL_CONNECT_3(emitter, signal, callback)
105 (GBL_CONNECT_4
(emitter, signal, emitter, callback))
106#define GBL_CONNECT_4(emitter, signal, receiver, callback)
107 (GBL_CONNECT_5
(emitter, signal, receiver, callback, GBL_NULL))
108#define GBL_CONNECT_5(emitter, signal, receiver, callback, userdata)
111#define GBL_SIGNALS_(instance, ...)
112 GBL_INLINE GBL_RESULT instance##_registerSignals_(instance* pSelf, GblMarshalFn* pMarshals) {
120#define GBL_SIGNAL_INSTALL_(instance, signal)
123GBL_CTX_VERIFY_CALL(GblSignal_install(GBL_TYPEID(instance),
124 GBL_STRINGIFY(GBL_TUPLE_FIRST signal),
127 GBL_TUPLE_FOREACH(GBL_SIGNAL_ARG_TYPE_, instance, GBL_TUPLE_REST(signal) )));
130#define GBL_SIGNAL_ARG_TYPE_(instance, pair)
133#define GBL_SIGNALS_REGISTER_(instance, marshals)
134 instance##_registerSignals_(instance, marshals)
#define GBL_CALLBACK(fn)
Casts a C function pointer to a generic callback type.
#define GBL_CTX_BEGIN(...)
#define GBL_INSTANCE(self)
Casts GblInstance-compatible to GblInstance.
#define GBL_TUPLE_FIRST(...)
#define GBL_TUPLE_FOREACH(MACRO_, DATA_, TUPLE_)
#define GBL_VA_OVERLOAD_CALL_ARGC(BASE,...)
#define GblSignal_connect(...)
void(* GblFnPtr)()
Type used for holding an untyped function pointer.
uint8_t GblBool
Basic boolean type, standardized to sizeof(char)