37#include "platform/internal/CThunkBase.h"
47 typedef void (T::*CCallbackSimple)(void);
48 typedef void (T::*CCallback)(
void *context);
52 init(instance, NULL, NULL);
55 inline CThunk(T *instance, CCallback callback)
57 init(instance, callback, NULL);
68 inline CThunk(T *instance, CCallbackSimple callback)
70 init(instance, (CCallback)callback, NULL);
73 inline CThunk(T &instance, CCallback callback)
75 init(instance, callback, NULL);
78 inline CThunk(T &instance, CCallbackSimple callback)
80 init(instance, (CCallback)callback, NULL);
83 inline CThunk(T &instance, CCallback callback,
void *context)
85 init(instance, callback, context);
88 inline void callback(CCallback callback)
93 inline void callback(CCallbackSimple callback)
95 _callback_simple = callback;
98 inline void context(
void *context)
103 inline void context(uint32_t context)
105 _context = (
void *)context;
108 inline uint32_t entry(
void)
110 if (_entry == NULL) {
111 _entry = cthunk_alloc(
this);
113 return (uint32_t)_entry;
117 inline operator CThunkEntry(
void)
119 return (CThunkEntry)entry();
123 inline operator uint32_t(
void)
129 inline void call(
void)
131 (((CThunkEntry)(entry()))());
138 CCallbackSimple _callback_simple;
147 T *instance = self->_instance;
148 void *context = self->_context;
149 CCallback callback = self->_callback;
151 if (instance && callback) {
152 (instance->*callback)(context);
156 inline void init(T *instance, CCallback callback,
void *context)
158 _instance = instance;
160 _callback = callback;
161 _trampoline = &trampoline;
Class for created a pointer with data bound to it.