DelegateSlot< R, As > Class Template Referenceabstract

#include <Pt/Delegate.h>

Wraps Delegate objects so that they can act as Slots. More...

Inherits BasicSlot< R, As... >.

Public Member Functions

 DelegateSlot (Delegate< R, As... > &delegate)
 Constructs from delegate.
 
Slotclone () const
 Clone this object with new.
 
virtual const Callback * callable () const
 Returns the callable converted to the type-erased Callback interface. More...
 
virtual void onConnect (const Connection &connection)
 Notifies of connects.
 
virtual void onDisconnect (const Connection &connection)
 Notifies of disconnects.
 
virtual bool equals (const Slot &slot) const
 Returns true if two slots are equal in value.
 

Related Functions

template<typename R , typename BaseT , typename ClassT , typename... As>
ConstMethodSlot< R, ClassT, As... > slot (ClassT &object, R(BaseT::*method)(As...) const)
 Returns a slot object for the given object/member pair.
 
template<typename R , typename... As>
DelegateSlot< R, As... > slot (Delegate< R, As... > &delegate)
 Returns a slot object for the given delegate.
 
template<typename R , typename... As>
FunctionSlot< R, As... > slot (R(*function)(As...))
 Returns a slot object for the given free/static function.
 
template<typename L , typename SlotT = typename LambdaSlotTraits<L>::Slot>
SlotT slot (L &&lambda)
 Returns a deduced slot object for the given lambda.
 
template<typename L , typename SlotT = typename LambdaSlotTraits<L>::Slot>
SlotT slot (Connectable &context, L &&lambda)
 Returns a deduced slot object for the given lambda.
 
template<typename R , typename... A, typename T , typename L = typename TypeTraits<T>::Value>
LambdaSlot< L, R, A... > slot (T &&lambda)
 Returns a slot object for the given lambda.
 
template<typename R , typename... A, typename T , typename L = typename TypeTraits<T>::Value>
LambdaSlot< L, R, A... > slot (Connectable &context, T &&lambda)
 Returns a slot object for the given lambda.
 
template<typename R , typename BaseT , typename ClassT , typename... As>
MethodSlot< R, ClassT, As... > slot (ClassT &object, R(BaseT::*method)(As...))
 Returns a slot object for the given object/member pair.
 
template<typename... As>
SignalSlot< As... > slot (Signal< As... > &signal)
 Returns a slot object for the given signal.
 

Detailed Description

template<typename R, typename... As>
class Pt::DelegateSlot< R, As >

DelegateSlot is a "slot wrapper" for Delegate objects. That is, it effectively converts a Delegate object into a Slot object, so that it can be used as the target of another Delegate. This allows chaining of delegates.

Member Function Documentation

◆ callable()

virtual const Callback* callable ( ) const
virtual

The concrete slot returns its stored callable converted to Callback via a derived-to-base conversion. Callers downcast the result to Callable<R, As...> or Invokable<As...> to invoke it.

Implements Slot.