42 #include "CThunkBase.h" 52 typedef void (T::*CCallbackSimple)(void);
53 typedef void (T::*CCallback)(
void *context);
57 init(instance, NULL, NULL);
60 inline CThunk(T *instance, CCallback callback)
62 init(instance, callback, NULL);
73 inline CThunk(T *instance, CCallbackSimple callback)
75 init(instance, (CCallback)callback, NULL);
78 inline CThunk(T &instance, CCallback callback)
80 init(instance, callback, NULL);
83 inline CThunk(T &instance, CCallbackSimple callback)
85 init(instance, (CCallback)callback, NULL);
88 inline CThunk(T &instance, CCallback callback,
void *context)
90 init(instance, callback, context);
93 inline void callback(CCallback callback)
98 inline void callback(CCallbackSimple callback)
100 _callback_simple = callback;
103 inline void context(
void *context)
108 inline void context(uint32_t context)
110 _context = (
void *)context;
113 inline uint32_t entry(
void)
115 if (_entry == NULL) {
116 _entry = cthunk_alloc(
this);
118 return (uint32_t)_entry;
122 inline operator CThunkEntry(
void)
124 return (CThunkEntry)entry();
128 inline operator uint32_t(
void)
134 inline void call(
void)
136 (((CThunkEntry)(entry()))());
143 CCallbackSimple _callback_simple;
152 T *instance =
self->_instance;
153 void *context =
self->_context;
154 CCallback callback =
self->_callback;
156 if (instance && callback) {
157 (instance->*callback)(context);
161 inline void init(T *instance, CCallback callback,
void *context)
163 _instance = instance;
165 _callback = callback;
166 _trampoline = &trampoline;
Class for created a pointer with data bound to it.