76class Dispatcher2:
public TDispatcherAllocatorBase
81 virtual ~Dispatcher2() {}
83 void call(
typename util::CallTraits<P1>::TParam iP1,
typename util::CallTraits<P2>::TParam iP2)
const
87 bool isEquivalent(
const Dispatcher2<P1, P2>* iOther)
const
89 return doIsEquivalent(iOther);
94 virtual void doCall(
typename util::CallTraits<P1>::TParam iP1,
typename util::CallTraits<P2>::TParam iP2)
const = 0;
95 virtual bool doIsEquivalent(
const Dispatcher2<P1, P2>* iOther)
const = 0;
97 Dispatcher2(
const Dispatcher2<P1, P2>& iOther);
98 Dispatcher2& operator=(
const Dispatcher2<P1, P2>& iOther);
114class Dispatcher2Function:
public Dispatcher2<P1, P2>
118 typedef FunctionType TFunction;
119 typedef Dispatcher2Function<P1, P2, FunctionType, Enable> TSelf;
121 Dispatcher2Function(
typename CallTraits<TFunction>::TParam iFunction):
126 const TFunction& function()
const
133 void doCall(
typename util::CallTraits<P1>::TParam iP1,
typename util::CallTraits<P2>::TParam iP2)
const override
142 bool doIsEquivalent(
const Dispatcher2<P1, P2>* other)
const override
144 if constexpr (impl::IsEqualityComparable<TFunction>::value)
146 return other &&
typeid( *other ) ==
typeid( TSelf )
147 &&
static_cast<const TSelf*
>(other)->function_ == function_;
170class Dispatcher2Method:
public Dispatcher2<P1, P2>
174 typedef Dispatcher2Method<P1, P2, ObjectPtr, Method> TSelf;
176 Dispatcher2Method(
typename CallTraits<ObjectPtr>::TParam iObject,
177 typename CallTraits<Method>::TParam iMethod):
185 void doCall(
typename util::CallTraits<P1>::TParam iP1,
typename util::CallTraits<P2>::TParam iP2)
const override
187 if (!object_ || !method_)
191 ((*object_).*method_)(iP1, iP2);
194 bool doIsEquivalent(
const Dispatcher2<P1, P2>* iOther)
const override
196 const TSelf* other =
dynamic_cast<const TSelf*
>(iOther);
197 return other && object_ == other->object_ && method_ == other->method_;