43#ifndef LASS_GUARDIAN_OF_INCLUSION_UTIL_IMPL_DISPATCHER_R_0_H
44#define LASS_GUARDIAN_OF_INCLUSION_UTIL_IMPL_DISPATCHER_R_0_H
67class DispatcherR0:
public TDispatcherAllocatorBase
72 virtual ~DispatcherR0() {}
77 bool isEquivalent(
const DispatcherR0<R>* iOther)
const
79 return doIsEquivalent(iOther);
84 DispatcherR0(
const DispatcherR0<R>& ) {}
88 virtual R doCall()
const = 0;
89 virtual bool doIsEquivalent(
const DispatcherR0<R>* iOther)
const = 0;
91 DispatcherR0& operator=(
const DispatcherR0<R>& iOther);
104 typename FunctionType,
105 typename Enable =
void
107class DispatcherR0Function:
public DispatcherR0<R>
111 typedef DispatcherR0Function<R, FunctionType, Enable> TSelf;
112 typedef FunctionType TFunction;
114 DispatcherR0Function(
typename CallTraits<TFunction>::TParam iFunction):
119 const TFunction& function()
const
126 R doCall()
const override
130 LASS_THROW_EX(EmptyCallback,
"You've tried to call an empty CallbackR0. Can't return a value.");
134 bool doIsEquivalent(
const DispatcherR0<R>* other)
const override
136 if constexpr (impl::IsEqualityComparable<TFunction>::value)
138 return other &&
typeid( *other ) ==
typeid( TSelf )
139 &&
static_cast<const TSelf*
>(other)->function_ == function_;
152#if LASS_HAVE_CPP_STD_11 && !LASS_HAVE_LAMBDA_OPERATOR_NOT
166 typename FunctionType
172 typename
meta::EnableIf<!HasOperatorNot<FunctionType>::value>::Type
178 typedef FunctionType TFunction;
185 const TFunction& function()
const
192 R doCall()
const override
196 bool doIsEquivalent(
const DispatcherR0<R>* )
const override
219class DispatcherR0Method:
public DispatcherR0<R>
223 typedef DispatcherR0Method<R, ObjectPtr, Method> TSelf;
225 DispatcherR0Method(
typename CallTraits<ObjectPtr>::TParam iObject,
226 typename CallTraits<Method>::TParam iMethod):
234 R doCall()
const override
236 if (!object_ || !method_)
238 LASS_THROW_EX(EmptyCallback,
"You've tried to call an empty CallbackR0. Can't return a value.");
240 return ((*object_).*method_)();
242 bool doIsEquivalent(
const DispatcherR0<R>* iOther)
const override
244 const TSelf* other =
dynamic_cast<const TSelf*
>(iOther);
245 return other && object_ == other->object_ && method_ == other->method_;
Dispatcher for lass::util::CallbackR0 to a free function:
abstract base class of all dispatchers for lass::util::CallbackR0.
general utility, debug facilities, ...
Library for Assembled Shared Sources.