FX::Generic::Functor< parslist > Class Template Reference
[Generic Tools in TnFOX]

#include <FXGenericTools.h>

Inheritance diagram for FX::Generic::Functor< parslist >:

Inheritance graph
[legend]

List of all members.


Detailed Description

template<typename parslist>
class FX::Generic::Functor< parslist >

Represents a callable API.

Functors are a compile-time abstraction of some callable entity ie; basically an enhanced function or member function pointer. Their real usefulness comes in with binding whereby a functor can be bound with a set of arguments to form an arbitrary call to some API. This facility is used throughout TnFOX as a much improved form of callback plus within the dynamic linkage facilities. Up to four arbitrary parameters are currently supported (this is easily extended, just ask).

With any decent optimising compiler, the considerable complexity of the functor implementation boils down to two virtual method calls. Functor itself only occupies 4 + 8 bytes.

This functor operates with move semantics - a copy means destruction of the original. If you want a real copy, call copy(). You may find the helper function FX::Generic::BindFunctor of use when binding a functor's arguments.

See also:
FX::Generic::BoundFunctor, FX::FXProcess

Public Types

typedef
FunctorHelper::ImplBaseOp
< parslist, TL::length
< parslist >::value-1 > 
ImplBase
typedef parslist ParsList
typedef ImplBase::R R
typedef ImplBase::P1 P1
typedef ImplBase::P2 P2
typedef ImplBase::P3 P3
typedef ImplBase::P4 P4

Public Member Functions

 Functor ()
template<typename fn>
 Functor (fn fnptr)
template<typename obj, typename fn>
 Functor (obj &objinst, fn fnptr)
template<typename obj, typename fn>
 Functor (obj *objinst, fn fnptr)
 Functor (void_ *fnptr)
 Functor (ImplBase *_fnimpl)
 Functor (Functor &o)
Functoroperator= (Functor &o)
Functor copy () const
bool operator== (const Functor &o) const
bool operator!= (const Functor &o) const
 operator Tester * () const
bool operator! () const
operator() ()
operator() (P1 p1)
operator() (P1 p1, P2 p2)
operator() (P1 p1, P2 p2, P3 p3)
operator() (P1 p1, P2 p2, P3 p3, P4 p4)

Constructor & Destructor Documentation

template<typename parslist>
FX::Generic::Functor< parslist >::Functor (  )  [inline]

template<typename parslist>
template<typename fn>
FX::Generic::Functor< parslist >::Functor ( fn  fnptr  )  [inline, explicit]

Constructs a functor calling a C-style function.

template<typename parslist>
template<typename obj, typename fn>
FX::Generic::Functor< parslist >::Functor ( obj &  objinst,
fn  fnptr 
) [inline]

Constructs a functor calling a member function of an object.

template<typename parslist>
template<typename obj, typename fn>
FX::Generic::Functor< parslist >::Functor ( obj *  objinst,
fn  fnptr 
) [inline]

Constructs a functor calling a member function of an object pointer.

template<typename parslist>
FX::Generic::Functor< parslist >::Functor ( void_ *  fnptr  )  [inline, explicit]

Constructs a functor from a raw address calling a C-style function. This uses Functor::void_ * to avoid the pointer consuming qualities of void *

template<typename parslist>
FX::Generic::Functor< parslist >::Functor ( ImplBase *  _fnimpl  )  [inline, explicit]

Constructs a functor with a predefined implementation. Note: takes ownership of pointer.


Member Function Documentation

template<typename parslist>
Functor FX::Generic::Functor< parslist >::copy (  )  const [inline]

Returns a copy of this functor.

template<typename parslist>
bool FX::Generic::Functor< parslist >::operator== ( const Functor< parslist > &  o  )  const [inline]

Compares two bound functors.

template<typename parslist>
bool FX::Generic::Functor< parslist >::operator!= ( const Functor< parslist > &  o  )  const [inline]

Negation compares two bound functors.

template<typename parslist>
R FX::Generic::Functor< parslist >::operator() (  )  [inline]

Calls what the functor points to.


The documentation for this class was generated from the following file:

(C) 2002-2008 Niall Douglas. Some parts (C) to assorted authors.
Generated on Fri Jun 13 22:30:12 2008 for TnFOX by doxygen v1.5.6