74class DispatcherR2:
public TDispatcherAllocatorBase
79 virtual ~DispatcherR2() {}
81 R call(
typename util::CallTraits<P1>::TParam iP1,
typename util::CallTraits<P2>::TParam iP2)
const
83 return doCall(iP1, iP2);
85 bool isEquivalent(
const DispatcherR2<R, P1, P2>* iOther)
const
87 return doIsEquivalent(iOther);
92 virtual R doCall(
typename util::CallTraits<P1>::TParam iP1,
typename util::CallTraits<P2>::TParam iP2)
const = 0;
93 virtual bool doIsEquivalent(
const DispatcherR2<R, P1, P2>* iOther)
const = 0;
95 DispatcherR2(
const DispatcherR2<R, P1, P2>& iOther);
96 DispatcherR2& operator=(
const DispatcherR2<R, P1, P2>& iOther);
112class DispatcherR2Function:
public DispatcherR2<R, P1, P2>
116 typedef FunctionType TFunction;
117 typedef DispatcherR2Function<R, P1, P2, FunctionType, Enable> TSelf;
119 DispatcherR2Function(
typename CallTraits<TFunction>::TParam iFunction):
124 const TFunction& function()
const
131 R doCall(
typename util::CallTraits<P1>::TParam iP1,
typename util::CallTraits<P2>::TParam iP2)
const override
135 LASS_THROW_EX(EmptyCallback,
"You've tried to call an empty CallbackR0. Can't return a value.");
137 return function_(iP1, iP2);
140 bool doIsEquivalent(
const DispatcherR2<R, P1, P2>* other)
const override
142 if constexpr (impl::IsEqualityComparable<TFunction>::value)
144 return other &&
typeid( *other ) ==
typeid( TSelf )
145 &&
static_cast<const TSelf*
>(other)->function_ == function_;
174class DispatcherR2Function
178 typename
meta::EnableIf<!HasOperatorNot<FunctionType>::value>::Type
180 :
public DispatcherR2<R, P1, P2>
184 typedef FunctionType TFunction;
186 DispatcherR2Function(
typename CallTraits<TFunction>::TParam iFunction):
191 const TFunction& function()
const
198 R doCall(
typename util::CallTraits<P1>::TParam iP1,
typename util::CallTraits<P2>::TParam iP2)
const override
200 return function_(iP1, iP2);
203 bool doIsEquivalent(
const DispatcherR2<R, P1, P2>* )
const override
225class DispatcherR2Method:
public DispatcherR2<R, P1, P2>
229 typedef DispatcherR2Method<R, P1, P2, ObjectPtr, Method> TSelf;
231 DispatcherR2Method(
typename CallTraits<ObjectPtr>::TParam iObject,
232 typename CallTraits<Method>::TParam iMethod):
240 R doCall(
typename util::CallTraits<P1>::TParam iP1,
typename util::CallTraits<P2>::TParam iP2)
const override
242 if (!object_ || !method_)
244 LASS_THROW_EX(EmptyCallback,
"You've tried to call an empty CallbackR0. Can't return a value.");
246 return ((*object_).*method_)(iP1, iP2);
249 bool doIsEquivalent(
const DispatcherR2<R, P1, P2>* iOther)
const override
251 const TSelf* other =
dynamic_cast<const TSelf*
>(iOther);
252 return other && object_ == other->object_ && method_ == other->method_;