74class DispatcherR1:
public TDispatcherAllocatorBase
79 virtual ~DispatcherR1() {}
81 R call(
typename util::CallTraits<P1>::TParam iP1)
const
85 bool isEquivalent(
const DispatcherR1<R, P1>* iOther)
const
87 return doIsEquivalent(iOther);
92 virtual R doCall(
typename util::CallTraits<P1>::TParam iP1)
const = 0;
93 virtual bool doIsEquivalent(
const DispatcherR1<R, P1>* iOther)
const = 0;
95 DispatcherR1(
const DispatcherR1<R, P1>& iOther);
96 DispatcherR1& operator=(
const DispatcherR1<R, P1>& iOther);
112class DispatcherR1Function:
public DispatcherR1<R, P1>
116 typedef FunctionType TFunction;
117 typedef DispatcherR1Function<R, P1, FunctionType, Enable> TSelf;
119 DispatcherR1Function(
typename CallTraits<TFunction>::TParam iFunction):
124 const TFunction& function()
const
131 R doCall(
typename util::CallTraits<P1>::TParam iP1)
const override
135 LASS_THROW_EX(EmptyCallback,
"You've tried to call an empty CallbackR0. Can't return a value.");
137 return function_(iP1);
140 bool doIsEquivalent(
const DispatcherR1<R, P1>* 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_;
225class DispatcherR1Method:
public DispatcherR1<R, P1>
229 typedef DispatcherR1Method<R, P1, ObjectPtr, Method> TSelf;
231 DispatcherR1Method(
typename CallTraits<ObjectPtr>::TParam iObject,
232 typename CallTraits<Method>::TParam iMethod):
240 R doCall(
typename util::CallTraits<P1>::TParam iP1)
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);
249 bool doIsEquivalent(
const DispatcherR1<R, P1>* iOther)
const override
251 const TSelf* other =
dynamic_cast<const TSelf*
>(iOther);
252 return other && object_ == other->object_ && method_ == other->method_;