ConstMethod< R, ClassT, ARGUMENTS > Class Template Reference

#include <Pt/ConstMethod.h>

Adapter for const class methods. More...

Inherits Callable< R, ARGUMENTS >.

Public Types

typedef R(ClassT::* MemFuncT )(ARGUMENTS) const
 The wrapped member function type.
 

Public Member Functions

 ConstMethod (ClassT &object, MemFuncT ptr)
 Wraps the given member function of the given object.
 
 ConstMethod (const ConstMethod &rhs)
 Copy constructor. More...
 
call (ARGUMENTS) const
 Same as operator().
 
ConstMethod< R, ARGUMENTS > * clone () const
 Returns a copy of this instance. More...
 
void invoke (ARGUMENTS) const
 Invoke the callable entity. More...
 
ClassT & object ()
 Returns a reference to this object's bound ClassT object.
 
const ClassT & object () const
 Returns a const reference to this object's bound ClassT object.
 
operator() (ARGUMENTS) const
 Call the callable entity. More...
 
bool operator== (const ConstMethod &rhs) const
 Returns true if both use the same object and 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 ClassT, typename ARGUMENTS>
class Pt::ConstMethod< R, ClassT, ARGUMENTS >

The ConstMethod class wraps const member functions as Callable objects so that they can be used with the signals/slots framework. There are partial specializations of this class template for up to ten arguments.

Constructor & Destructor Documentation

ConstMethod ( const ConstMethod< R, ClassT, ARGUMENTS > &  rhs)

The created object refers to the same member function and object instance as the given one.

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 >.

ConstMethod<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 >.