34 #include "../System/exception.h"
35 #include "../System/sharedptr.h"
39 template <
typename RetVal,
typename P1,
typename P2,
typename P3,
typename P4>
47 virtual RetVal
invoke(P1 p1, P2 p2, P3 p3, P4 p4)
const = 0;
52 template <
typename RetVal,
typename P1,
typename P2,
typename P3,
typename P4>
61 RetVal
invoke(P1 p1, P2 p2, P3 p3, P4 p4)
const
71 template <
typename RetVal,
typename P1,
typename P2,
typename P3,
typename P4,
typename UserData>
81 RetVal
invoke(P1 p1, P2 p2, P3 p3, P4 p4)
const
93 template <
typename RetVal,
typename P1,
typename P2,
typename P3,
typename P4,
typename InstanceClass>
98 RetVal (InstanceClass::*
member_func)(P1, P2, P3, P4))
99 : instance(instance), member_func(member_func)
103 RetVal
invoke(P1 p1, P2 p2, P3 p3, P4 p4)
const
105 return (instance->*member_func)(p1, p2, p3, p4);
110 RetVal (InstanceClass::*member_func)(P1, P2, P3, P4);
115 template <
typename RetVal,
typename P1,
typename P2,
typename P3,
typename P4,
typename InstanceClass,
typename UserData>
121 : instance(instance), member_func(member_func), user_data(user_data)
125 RetVal
invoke(P1 p1, P2 p2, P3 p3, P4 p4)
const
127 return (instance->*member_func)(p1, p2, p3, p4,
user_data);
132 RetVal (InstanceClass::*member_func)(P1, P2, P3, P4, UserData);
139 template <
typename RetVal,
class P1,
class P2,
class P3,
class P4,
class Functor>
148 RetVal
invoke(P1 p1, P2 p2, P3 p3, P4 p4)
const
150 return functor(p1, p2, p3, p4);
159 template <
typename RetVal,
typename P1,
typename P2,
typename P3,
typename P4>
182 template<
typename UserData>
183 CL_Callback_4(RetVal (*
function)(P1, P2, P3, P4, UserData),
const UserData &user_data)
188 template<
class InstanceClass>
189 CL_Callback_4(InstanceClass *instance, RetVal (InstanceClass::*
function)(P1, P2, P3, P4))
194 template<
class InstanceClass,
typename UserData>
195 CL_Callback_4(InstanceClass *instance, RetVal (InstanceClass::*
function)(P1, P2, P3, P4, UserData),
const UserData &user_data)
200 void set(RetVal (*
function)(P1, P2, P3, P4))
205 template<
typename UserData>
206 void set(RetVal (*
function)(P1, P2, P3, P4, UserData),
const UserData &user_data)
208 impl = CL_SharedPtr< CL_Callback_Impl_4<RetVal, P1, P2, P3, P4> >(
new CL_Callback_Impl_4_static_user<RetVal, P1, P2, P3, P4, UserData>(
function, user_data));
211 template<
class InstanceClass>
212 void set(InstanceClass *instance, RetVal (InstanceClass::*
function)(P1, P2, P3, P4))
214 impl = CL_SharedPtr< CL_Callback_Impl_4<RetVal, P1, P2, P3, P4> >(
new CL_Callback_Impl_4_member<RetVal, P1, P2, P3, P4, InstanceClass>(instance,
function));
217 template<
class InstanceClass,
typename UserData>
218 void set(InstanceClass *instance, RetVal (InstanceClass::*
function)(P1, P2, P3, P4, UserData),
const UserData &user_data)
220 impl = CL_SharedPtr< CL_Callback_Impl_4<RetVal, P1, P2, P3, P4> >(
new CL_Callback_Impl_4_member_user<RetVal, P1, P2, P3, P4, InstanceClass, UserData>(instance,
function, user_data));
225 impl = CL_SharedPtr< CL_Callback_Impl_4<RetVal, P1, P2, P3, P4> >();
228 RetVal
invoke(P1 p1, P2 p2, P3 p3, P4 p4)
const
230 return impl->invoke(p1, p2, p3, p4);
239 CL_SharedPtr< CL_Callback_Impl_4<RetVal, P1, P2, P3, P4> > impl;
245 template <
typename RetVal,
typename P1,
typename P2,
typename P3,
typename P4>
258 template<
class Functor>