Method< R, ClassT, As > Class Template Referenceabstract

#include <Pt/Method.h>

Adapter for class methods. More...

Inherits Callable< R, As... >.

Public Types

typedef R(ClassT::* MemFuncT) (As...)
 The wrapped member function signature.
 

Public Member Functions

 Method (ClassT &object, MemFuncT method)
 Wraps the given object/member pair.
 
ClassT & object ()
 Returns a reference to this object's wrapped ClassT object.
 
const ClassT & object () const
 Returns a const reference to the wrapped ClassT object.
 
const MemFuncTmethod () const
 Returns a reference to the wrapped member function.
 
call (As... args) const
 Calls the callable entity and returns its result. More...
 
void invoke (As... args) const
 Invokes the invokable entity with the given arguments. More...
 
bool operator== (const Method &other) const
 Returns true if both use the same object and function pointer.
 
virtual Callableclone () const=0
 Returns a copy of this instance. More...
 
operator() (As... args) const
 Same as call().
 

Related Functions

ConstMethod< R, ClassT, As... > callable (ClassT &object, R(BaseT::*method)(As...) const)
 Returns a ConstMethod object for the given object/method pair.
 
Function< R, As... > callable (R(*function)(As...))
 Returns a Function wrapper for the given free/static function.
 
Method< R, ClassT, As... > callable (ClassT &object, R(BaseT::*method)(As...))
 Returns a Method object for the given object/method pair.
 

Detailed Description

template<typename R, typename ClassT, typename... As>
class Pt::Method< R, ClassT, As >

The Method class wraps member functions as Callable objects so that they can be used with the signals/slots framework.

Member Function Documentation

◆ call()

R call ( As...  args) const
virtual

This is the primary non-virtual entry point used by Delegate and other callers that need the return value. All derived classes must implement this.

Implements Callable< R, As... >.

◆ invoke()

void invoke ( As...  args) const
virtual

The passed arguments must match the template parameters.

Implements Callable< R, As... >.

◆ clone()

virtual Callable* clone ( ) const
pure virtualinherited

A copy of the instance is created with new is returned. Ownership is transfered to the caller, who has to delete it.