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