Function< R, ARGUMENTS > Class Template Reference

#include <Pt/Function.h>

Wraps free functions into a generic callable for use with the signals/slots. More...

Inherits Callable< R, ARGUMENTS >.

Public Types

typedef R(* FuncT )(ARGUMENTS)
 The function signature wrapped by this class.
 

Public Member Functions

 Function (FuncT func)
 Construct from function pointer.
 
 Function (const Function &f)
 Copy Constructor.
 
call (ARGUMENTS) const
 Same as operator().
 
Function< R, ARGUMENTS > * clone () const
 Returns a copy of this instance. More...
 
void invoke (ARGUMENTS) const
 Invoke the callable entity. More...
 
operator() (ARGUMENTS args) const
 Call the callable entity. More...
 
bool operator== (const Function &rhs) const
 Returns true if both use the same function pointer.
 

Related Functions

template<class R , class BaseT , class ClassT , typename ARGS >
Method< R, ClassT, ARGS > callable (ClassT &obj, R(BaseT::*ptr)(ARGS))
 Returns a Method object for the given object/method pair.
 
template<class R , class BaseT , class C , typename ARGS >
ConstMethod< R, C, ARGS > callable (C &obj, R(BaseT::*ptr)(ARGS) const )
 Returns a ConstMethod object for the given object/method pair.
 
template<typename R , typename ARGS >
Function< R, ARGS > callable (R(*func)(ARGS))
 Returns a Function wrapper for the given free/static function.
 

Detailed Description

template<typename R, typename ARGUMENTS>
class Pt::Function< R, ARGUMENTS >

The Function class wraps free functions in the form of a Callable, for use with the signals/slots framework.

Member Function Documentation

R operator() ( ARGUMENTS  ) const
virtual

Since this class template is partially specialized, the passed arguments ARGUMENTS must match the template parameters.

Implements Callable< R, ARGUMENTS >.

Function<R, ARGUMENTS>* clone ( ) const
virtual

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

Implements Callable< R, ARGUMENTS >.

void invoke ( ARGUMENTS  ) const
virtualinherited

Inherited from Invokable. Ignores the return value of the Callable. Since this class template is partially specialized, the passed arguments ARGUMENTS must match the template parameters.

Implements Invokable< ARGUMENTS >.