29 template<
typename TYPE>
42 typedef RT (*Method)(
const void*);
49 FXCallback(Method m,
const void* o):method(m),object(o){ }
52 template <
typename T,RT (T::*mfn)()>
53 static RT MethodCall(
const void* obj){
return (static_cast<T*>(const_cast<void*>(obj))->*mfn)(); }
56 template <
typename T,RT (T::*mfn)() const>
57 static RT ConstMethodCall(
const void* obj){
return (static_cast<const T*>(obj)->*mfn)(); }
61 static RT FunctionCall(
const void*){
return (fn)(); }
64 static RT DefaultCall(
const void*){
return RT(); }
69 FXCallback():method(&DefaultCall),object(
nullptr){ }
75 FXCallback& operator=(
const FXCallback& org){ method=org.method;
object=org.object;
return *
this; }
78 FXbool operator==(
const FXCallback& other)
const {
return method==other.method &&
object==other.object; }
79 FXbool operator!=(
const FXCallback& other)
const {
return method!=other.method ||
object!=other.object; }
82 RT operator()()
const {
return (*method)(object); }
85 template<
typename TYPE,RT (TYPE::* mfn)()>
86 inline void connect(TYPE* obj){ method=&MethodCall<TYPE,mfn>;
object=obj; }
89 template<
typename TYPE,RT (TYPE::* mfn)() const>
90 inline void connect(
const TYPE* obj){ method=&ConstMethodCall<TYPE,mfn>;
object=obj; }
94 inline void connect(){ method=&FunctionCall<fn>;
object=
nullptr; }
97 bool connected()
const {
return (method!=&DefaultCall); }
100 void disconnect(){ method=&DefaultCall;
object=
nullptr; }
106 template<
typename TYPE,RT (TYPE::* mfn)()>
110 template<
typename TYPE,RT (TYPE::* mfn)() const>
111 static inline FXCallback create(
const TYPE* obj){
return FXCallback(&ConstMethodCall<TYPE,mfn>,obj); }
125 template<
typename RT,
typename PT1>
128 typedef RT (*Method)(
const void*,PT1);
135 FXCallback(Method m,
const void* o):method(m),object(o){ }
138 template <
typename T,RT (T::*mfn)(PT1)>
139 static RT MethodCall(
const void* obj,PT1 p1){
return (static_cast<T*>(const_cast<void*>(obj))->*mfn)(p1); }
142 template <
typename T,RT (T::*mfn)(PT1) const>
143 static RT ConstMethodCall(
const void* obj,PT1 p1){
return (static_cast<const T*>(obj)->*mfn)(p1); }
146 template<RT (*fn)(PT1)>
147 static RT FunctionCall(
const void*,PT1 p1){
return (fn)(p1); }
150 static RT DefaultCall(
const void*,PT1){
return RT(); }
155 FXCallback():method(&DefaultCall),object(
nullptr){ }
161 FXCallback& operator=(
const FXCallback& org){ method=org.method;
object=org.object;
return *
this; }
164 FXbool operator==(
const FXCallback& other)
const {
return method==other.method &&
object==other.object; }
165 FXbool operator!=(
const FXCallback& other)
const {
return method!=other.method ||
object!=other.object; }
168 RT operator()(PT1 p1)
const {
return (*method)(object,p1); }
171 template<
typename TYPE,RT (TYPE::* mfn)(PT1)>
172 inline void connect(TYPE* obj){ method=&MethodCall<TYPE,mfn>;
object=obj; }
175 template<
typename TYPE,RT (TYPE::* mfn)(PT1) const>
176 inline void connect(
const TYPE* obj){ method=&ConstMethodCall<TYPE,mfn>;
object=obj; }
179 template<RT (*fn)(PT1)>
180 inline void connect(){ method=&FunctionCall<fn>;
object=
nullptr; }
183 bool connected()
const {
return (method!=&DefaultCall); }
186 void disconnect(){ method=&DefaultCall;
object=
nullptr; }
192 template<
typename TYPE,RT (TYPE::* mfn)(PT1)>
196 template<
typename TYPE,RT (TYPE::* mfn)(PT1) const>
197 static inline FXCallback create(
const TYPE* obj){
return FXCallback(&ConstMethodCall<TYPE,mfn>,obj); }
200 template<RT (*fn)(PT1)>
211 template<
typename RT,
typename PT1,
typename PT2>
214 typedef RT (*Method)(
const void*,PT1,PT2);
221 FXCallback(Method m,
const void* o):method(m),object(o){ }
224 template <
typename T,RT (T::*mfn)(PT1,PT2)>
225 static RT MethodCall(
const void* obj,PT1 p1,PT2 p2){
return (static_cast<T*>(const_cast<void*>(obj))->*mfn)(p1,p2); }
228 template <
typename T,RT (T::*mfn)(PT1,PT2) const>
229 static RT ConstMethodCall(
const void* obj,PT1 p1,PT2 p2){
return (static_cast<const T*>(obj)->*mfn)(p1,p2); }
232 template<RT (*fn)(PT1,PT2)>
233 static RT FunctionCall(
const void*,PT1 p1,PT2 p2){
return (fn)(p1,p2); }
236 static RT DefaultCall(
const void*,PT1,PT2){
return RT(); }
241 FXCallback():method(&DefaultCall),object(
nullptr){ }
247 FXCallback& operator=(
const FXCallback& org){ method=org.method;
object=org.object;
return *
this; }
250 FXbool operator==(
const FXCallback& other)
const {
return method==other.method &&
object==other.object; }
251 FXbool operator!=(
const FXCallback& other)
const {
return method!=other.method ||
object!=other.object; }
254 RT operator()(PT1 p1,PT2 p2)
const {
return (*method)(object,p1,p2); }
257 template<
typename TYPE,RT (TYPE::* mfn)(PT1,PT2)>
258 inline void connect(TYPE* obj){ method=&MethodCall<TYPE,mfn>;
object=obj; }
261 template<
typename TYPE,RT (TYPE::* mfn)(PT1,PT2) const>
262 inline void connect(
const TYPE* obj){ method=&ConstMethodCall<TYPE,mfn>;
object=obj; }
265 template<RT (*fn)(PT1,PT2)>
266 inline void connect(){ method=&FunctionCall<fn>;
object=
nullptr; }
269 bool connected()
const {
return (method!=&DefaultCall); }
272 void disconnect(){ method=&DefaultCall;
object=
nullptr; }
278 template<
typename TYPE,RT (TYPE::* mfn)(PT1,PT2)>
282 template<
typename TYPE,RT (TYPE::* mfn)(PT1,PT2) const>
283 static inline FXCallback create(
const TYPE* obj){
return FXCallback(&ConstMethodCall<TYPE,mfn>,obj); }
286 template<RT (*fn)(PT1,PT2)>
297 template<
typename RT,
typename PT1,
typename PT2,
typename PT3>
300 typedef RT (*Method)(
const void*,PT1,PT2,PT3);
307 FXCallback(Method m,
const void* o):method(m),object(o){ }
310 template <
typename T,RT (T::*mfn)(PT1,PT2,PT3)>
311 static RT MethodCall(
const void* obj,PT1 p1,PT2 p2,PT3 p3){
return (static_cast<T*>(const_cast<void*>(obj))->*mfn)(p1,p2,p3); }
314 template <
typename T,RT (T::*mfn)(PT1,PT2,PT3) const>
315 static RT ConstMethodCall(
const void* obj,PT1 p1,PT2 p2,PT3 p3){
return (static_cast<const T*>(obj)->*mfn)(p1,p2,p3); }
318 template<RT (*fn)(PT1,PT2,PT3)>
319 static RT FunctionCall(
const void*,PT1 p1,PT2 p2,PT3 p3){
return (fn)(p1,p2,p3); }
322 static RT DefaultCall(
const void*,PT1,PT2,PT3){
return RT(); }
327 FXCallback():method(&DefaultCall),object(
nullptr){ }
333 FXCallback& operator=(
const FXCallback& org){ method=org.method;
object=org.object;
return *
this; }
336 FXbool operator==(
const FXCallback& other)
const {
return method==other.method &&
object==other.object; }
337 FXbool operator!=(
const FXCallback& other)
const {
return method!=other.method ||
object!=other.object; }
340 RT operator()(PT1 p1,PT2 p2,PT3 p3)
const {
return (*method)(object,p1,p2,p3); }
343 template<
typename TYPE,RT (TYPE::* mfn)(PT1,PT2,PT3)>
344 inline void connect(TYPE* obj){ method=&MethodCall<TYPE,mfn>;
object=obj; }
347 template<
typename TYPE,RT (TYPE::* mfn)(PT1,PT2,PT3) const>
348 inline void connect(
const TYPE* obj){ method=&ConstMethodCall<TYPE,mfn>;
object=obj; }
351 template<RT (*fn)(PT1,PT2,PT3)>
352 inline void connect(){ method=&FunctionCall<fn>;
object=
nullptr; }
355 bool connected()
const {
return (method!=&DefaultCall); }
358 void disconnect(){ method=&DefaultCall;
object=
nullptr; }
364 template<
typename TYPE,RT (TYPE::* mfn)(PT1,PT2,PT3)>
368 template<
typename TYPE,RT (TYPE::* mfn)(PT1,PT2,PT3) const>
369 static inline FXCallback create(
const TYPE* obj){
return FXCallback(&ConstMethodCall<TYPE,mfn>,obj); }
372 template<RT (*fn)(PT1,PT2,PT3)>
383 template<
typename RT,
typename PT1,
typename PT2,
typename PT3,
typename PT4>
386 typedef RT (*Method)(
const void*,PT1,PT2,PT3,PT4);
393 FXCallback(Method m,
const void* o):method(m),object(o){ }
396 template <
typename T,RT (T::*mfn)(PT1,PT2,PT3,PT4)>
397 static RT MethodCall(
const void* obj,PT1 p1,PT2 p2,PT3 p3,PT4 p4){
return (static_cast<T*>(const_cast<void*>(obj))->*mfn)(p1,p2,p3,p4); }
400 template <
typename T,RT (T::*mfn)(PT1,PT2,PT3,PT4) const>
401 static RT ConstMethodCall(
const void* obj,PT1 p1,PT2 p2,PT3 p3,PT4 p4){
return (static_cast<const T*>(obj)->*mfn)(p1,p2,p3,p4); }
404 template<RT (*fn)(PT1,PT2,PT3,PT4)>
405 static RT FunctionCall(
const void*,PT1 p1,PT2 p2,PT3 p3,PT4 p4){
return (fn)(p1,p2,p3,p4); }
408 static RT DefaultCall(
const void*,PT1,PT2,PT3,PT4){
return RT(); }
413 FXCallback():method(&DefaultCall),object(
nullptr){ }
419 FXCallback& operator=(
const FXCallback& org){ method=org.method;
object=org.object;
return *
this; }
422 FXbool operator==(
const FXCallback& other)
const {
return method==other.method &&
object==other.object; }
423 FXbool operator!=(
const FXCallback& other)
const {
return method!=other.method ||
object!=other.object; }
426 RT operator()(PT1 p1,PT2 p2,PT3 p3,PT4 p4)
const {
return (*method)(object,p1,p2,p3,p4); }
429 template<
typename TYPE,RT (TYPE::* mfn)(PT1,PT2,PT3,PT4)>
430 inline void connect(TYPE* obj){ method=&MethodCall<TYPE,mfn>;
object=obj; }
433 template<
typename TYPE,RT (TYPE::* mfn)(PT1,PT2,PT3,PT4) const>
434 inline void connect(
const TYPE* obj){ method=&ConstMethodCall<TYPE,mfn>;
object=obj; }
437 template<RT (*fn)(PT1,PT2,PT3,PT4)>
438 inline void connect(){ method=&FunctionCall<fn>;
object=
nullptr; }
441 bool connected()
const {
return (method!=&DefaultCall); }
444 void disconnect(){ method=&DefaultCall;
object=
nullptr; }
450 template<
typename TYPE,RT (TYPE::* mfn)(PT1,PT2,PT3,PT4)>
454 template<
typename TYPE,RT (TYPE::* mfn)(PT1,PT2,PT3,PT4) const>
455 static inline FXCallback create(
const TYPE* obj){
return FXCallback(&ConstMethodCall<TYPE,mfn>,obj); }
458 template<RT (*fn)(PT1,PT2,PT3,PT4)>
Definition: FXCallback.h:30
Definition: FX4Splitter.h:28