59#ifndef LASS_GUARDIAN_OF_INCLUSION_UTIL_CALLBACK_R_0_H
60#define LASS_GUARDIAN_OF_INCLUSION_UTIL_CALLBACK_R_0_H
95 typedef SharedPtr< impl::DispatcherR0<R> > TDispatcherPtr;
107 template <
typename Function>
109 dispatcher_(make(iFunction,
meta::Wrap<typename
meta::IsDerived<Function, impl::DispatcherR0<R> >::Type>()))
115 template <
typename ObjectPtr,
typename Method>
117 dispatcher_(new impl::DispatcherR0Method<R, ObjectPtr, Method>(iObject, iMethod))
124 dispatcher_(iOther.dispatcher_)
131 dispatcher_(std::move(iOther.dispatcher_))
151 dispatcher_ = std::move(iOther.dispatcher_);
161 LASS_THROW_EX(EmptyCallback,
"You've tried to call an empty CallbackR0. Can't return a value.");
163 return dispatcher_->call();
180 return dispatcher_.isEmpty();
187 return dispatcher_.isEmpty();
192 explicit operator bool()
const
194 return !dispatcher_.isEmpty();
201 dispatcher_.swap(iOther.dispatcher_);
209 if (dispatcher_ == iOther.dispatcher_)
213 return dispatcher_ && dispatcher_->isEquivalent(iOther.dispatcher_.get());
216 const TDispatcherPtr& dispatcher()
const
223 template <
typename Function>
224 static TDispatcherPtr make(Function iFunction, meta::Wrap<meta::False>)
226 return TDispatcherPtr(
new impl::DispatcherR0Function<R, Function>(iFunction));
229 template <
typename Dispatcher>
230 static TDispatcherPtr make(Dispatcher iDispatcher, meta::Wrap<meta::True>)
232 return TDispatcherPtr(
new Dispatcher(iDispatcher));
235 TDispatcherPtr dispatcher_;
254template <
typename R>
inline
265template <
typename R>
inline
276template <
typename ObjectPtr,
typename Object,
typename R>
inline
287template <
typename ObjectPtr,
typename Object,
typename R>
inline
299#define LASS_PRIM_HAVE_PY_EXPORT_TRAITS_CALLBACK_R0
300#ifdef LASS_GUARDIAN_OF_INCLUSION_UTIL_CALLBACK_PYTHON_H
callback with 0 parameter(s) and without returnvalue.
CallbackR0(Function iFunction)
Construct function callback.
bool isEmpty() const
Returns true if no callback dispatcher is assigned to this object.
CallbackR0(TSelf &&iOther) noexcept
move constructor
bool operator!=(const CallbackR0< R > &iA, const CallbackR0< R > &iB)
return true if two callbacks are different
R operator()() const
THE operator.
CallbackR0(const TSelf &iOther)
copy constructor
TSelf & operator=(TSelf &&iOther) noexcept
move assignment operator
CallbackR0()
Default constructor, construct empty callback.
void reset()
Reset to empty callback.
CallbackR0< R > makeCallback(R(*iFunction)())
make a CallbackR0 from a function
CallbackR0< R > makeCallback(ObjectPtr iObject, R(Object::*iMethod)() const)
make a CallbackR0 from a object and const method
bool operator==(const TSelf &iOther) const
return true if two callbacks call the same function/method, NEEDS RTTI!
bool operator!() const
return this->isEmpty()
const CallbackR0< R > & makeCallback(const CallbackR0< R > &iCallback)
make a CallbackR0 from a callback
TSelf & operator=(const TSelf &iOther)
assignment operator
CallbackR0(ObjectPtr iObject, Method iMethod)
Construct object/method callback.
CallbackR0< R > makeCallback(ObjectPtr iObject, R(Object::*iMethod)())
make a CallbackR0 from a object and method
void swap(TSelf &iOther)
Swaps the dispatcher of this callback with the dispatcher of another.
general utility, debug facilities, ...
Library for Assembled Shared Sources.