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