66#ifndef LASS_GUARDIAN_OF_INCLUSION_UTIL_CALLBACK_R_2_H
67#define LASS_GUARDIAN_OF_INCLUSION_UTIL_CALLBACK_R_2_H
95 typename P1,
typename P2
102 typedef SharedPtr< impl::DispatcherR2<R, P1, P2> > TDispatcherPtr;
114 template <
typename FunctionType>
116 dispatcher_(new impl::DispatcherR2Function<R, P1, P2, FunctionType>(iFunction))
122 template <
typename ObjectPtr,
typename Method>
124 dispatcher_(new impl::DispatcherR2Method<R, P1, P2, ObjectPtr, Method>(iObject, iMethod))
131 dispatcher_(iOther.dispatcher_)
138 dispatcher_(std::move(iOther.dispatcher_))
158 dispatcher_ = std::move(iOther.dispatcher_);
164 R
operator()(
typename util::CallTraits<P1>::TParam iP1,
typename util::CallTraits<P2>::TParam iP2)
const
168 LASS_THROW_EX(EmptyCallback,
"You've tried to call an empty CallbackR2. Can't return a value.");
170 return dispatcher_->call(iP1, iP2);
187 return dispatcher_.isEmpty();
194 return dispatcher_.isEmpty();
199 explicit operator bool()
const
201 return !dispatcher_.isEmpty();
208 dispatcher_.swap(iOther.dispatcher_);
216 if (dispatcher_ == iOther.dispatcher_)
220 return dispatcher_ && dispatcher_->isEquivalent(iOther.dispatcher_.get());
223 const TDispatcherPtr& dispatcher()
const
230 TDispatcherPtr dispatcher_;
238template<
typename R,
typename P1,
typename P2>
248template <
typename R,
typename P1,
typename P2>
inline
259template <
typename R,
typename P1,
typename P2>
inline
270template <
typename ObjectPtr,
typename Object,
typename R,
typename P1,
typename P2>
inline
281template <
typename ObjectPtr,
typename Object,
typename R,
typename P1,
typename P2>
inline
293#define LASS_PRIM_HAVE_PY_EXPORT_TRAITS_CALLBACK_R2
294#ifdef LASS_GUARDIAN_OF_INCLUSION_UTIL_CALLBACK_PYTHON_H
R operator()(typename util::CallTraits< P1 >::TParam iP1, typename util::CallTraits< P2 >::TParam iP2) const
THE operator.
CallbackR2< R, P1, P2 > makeCallback(ObjectPtr iObject, R(Object::*iMethod)(P1, P2))
make a CallbackR2 from a object and method
TSelf & operator=(const TSelf &iOther)
assignment operator
CallbackR2< R, P1, P2 > makeCallback(ObjectPtr iObject, R(Object::*iMethod)(P1, P2) const)
make a CallbackR2 from a object and const method
bool operator==(const TSelf &iOther) const
return true if two callbacks call the same function/method, NEEDS RTTI!
void reset()
Reset to empty callback.
CallbackR2(FunctionType iFunction)
Construct function callback.
bool isEmpty() const
Returns true if no callback dispatcher is assigned to this object.
bool operator!() const
return this->isEmpty()
CallbackR2(TSelf &&iOther) noexcept
move constructor
CallbackR2(const TSelf &iOther)
copy constructor
CallbackR2< R, P1, P2 > makeCallback(R(*iFunction)(P1, P2))
make a CallbackR2 from a function
bool operator!=(const CallbackR2< R, P1, P2 > &iA, const CallbackR2< R, P1, P2 > &iB)
return true if two callbacks are different
void swap(TSelf &iOther)
Swaps the dispatcher of this callback with the dispatcher of another.
const CallbackR2< R, P1, P2 > & makeCallback(const CallbackR2< R, P1, P2 > &iCallback)
make a CallbackR2 from a function
TSelf & operator=(TSelf &&iOther) noexcept
assignment operator
CallbackR2(ObjectPtr iObject, Method iMethod)
Construct object/method callback.
CallbackR2()
Default constructor, construct empty callback.
general utility, debug facilities, ...
Library for Assembled Shared Sources.