33#include <Pt/Callable.h>
45template <
typename R,
typename... As>
63 return (*_function)(args...);
69 (*_function)(args...);
81 return _function == other._function;
92template <
typename R,
typename... As>
122 return other && _function == other->_function;
134template <
typename R,
typename... As>
137 return Function<R, As...>(function);
145template <
typename R,
typename... As>
Base type for various "slot" types.
Definition Slot.h:92
An interface for all callable entities.
Definition Callable.h:48
Function< R, As... > callable(R(*function)(As...))
Returns a Function wrapper for the given free/static function.
Definition Function.h:135
Represents a connection between a Signal/Delegate and a slot.
Definition Connection.h:96
Wraps Function objects so that they can act as slots.
Definition Function.h:94
virtual bool equals(const Slot &slot) const
Returns true if two slots are equal in value.
Definition Function.h:119
virtual void onDisconnect(const Connection &)
Notifies of disconnects.
Definition Function.h:116
virtual const Callback * callable() const
Returns the callable converted to the type-erased Callback interface.
Definition Function.h:108
virtual void onConnect(const Connection &)
Notifies of connects.
Definition Function.h:113
FunctionSlot(const Function< R, As... > &function)
Constructs from callable.
Definition Function.h:98
Slot * clone() const
Clone this object with new.
Definition Function.h:102
Wraps free functions into a generic callable for use with the signals/slots.
Definition Function.h:47
R(*) FuncT(As...)
The function signature wrapped by this class.
Definition Function.h:51
Function(FuncT function)
Construct from function pointer.
Definition Function.h:56
R call(As... args) const
Calls the callable entity and returns its result.
Definition Function.h:61
bool operator==(const Function &other) const
Returns true if both use the same function pointer.
Definition Function.h:79
void invoke(As... args) const
Invokes the invokable entity with the given arguments.
Definition Function.h:67
Function * clone() const
Returns a copy of this instance.
Definition Function.h:72
Endpoint of a signal/slot connection.
Definition Slot.h:55
FunctionSlot< R, As... > slot(R(*function)(As...))
Returns a slot object for the given free/static function.
Definition Function.h:146
ConstMethodSlot< R, ClassT, As... > slot(ClassT &object, R(BaseT::*method)(As...) const)
Definition ConstMethod.h:172
virtual const Callback * callable() const =0
Returns the callable converted to the type-erased Callback interface.
Core module.
Definition Allocator.h:33