Rogue Wave banner
Previous fileTop of DocumentContentsIndex pageNext file
Threads Module Reference Guide
Rogue Wave web site:  Home Page  |  Main Documentation Page

rwtMakeFunctorR0()

Module:  Threads   Package:  Functor


Global Functions and Macros

Local Index

Members

Non-Members

Header File

#include <rw/functor/functorR0.h>

Description

A function object, or functor, is an object that encapsulates a call to an associated global or member function. When a functor is invoked, it calls the associated function.

The rwtMakeFunctorR0() functions and macros are provided to construct functors based on the RWTFunctorR0<SR> class. The RWTFunctorR0<SR> class acts as the handle for a family of functor implementation classes based on the RWTFunctorR0Imp<SR> class. A functor based on RWTFunctorR0<SR> is invoked with no arguments and returns a value of type SR, but the implementation classes can accept functions with up to three arguments. The values for the additional arguments are defined when an implementation class instance is constructed, and are passed to the function each time the functor is invoked.

Each rwtMakeFunctorR0() function or macro instantiates and constructs an appropriate functor implementation class instance and returns an RWTFunctorR0<SR> handle that is bound to that instance.

rwtMakeFunctorR0() comes in two flavors. First, there is a set of overloaded global function templates. Since not all compilers are able to handle templates to the degree required by these functions, we also provide a corresponding set of macros. The template functions are slightly easier to use and you only have to remember one name. The macros are more portable but they do require more arguments; and because we cannot overload macros, each must have a unique name.

In naming the macros we have employed a convention to make the names easier to remember. Each name begins with rwtMakeFunctorR0(), which will be followed by either a G if the macro is expecting a global function, or an M if it is expecting a member function. At that point the name is complete if the associated global or member function takes no arguments. Otherwise we add one of A1, A2, or A3 for functions with 1, 2, or 3 arguments respectively. For example, you will use macro rwtMakeFunctorR0G() to create a functor that calls a global function that takes no arguments. The macro rwtMakeFunctorR0MA2() will create a functor that calls a member function that takes two arguments.

Example Using Templates

Example Using Macros

Global Function Templates

The following information applies to each of the function templates in this section:

template <class SR, class DR>
RWTFunctorR0<SR> 
rwtMakeFunctorR0(SR (*invokeAs)(void), DR (*function)(void));
template <class SR, class DR, class A1, class AA1>
RWTFunctorR0<SR> 
rwtMakeFunctorR0(SR (*invokeAs)(void), DR (*function)(A1), 
AA1 a1)
template <class SR, class DR, 
class A1, class A2, class AA1, class AA2> RWTFunctorR0<SR> rwtMakeFunctorR0(SR (*invokeAs)(void),
DR (*function)(A1,A2), AA1 a1, AA2 a2)
template <class SR, class DR, class A1, class A2, class A3, 
class AA1, class AA2, class AA3> RWTFunctorR0<SR> rwtMakeFunctorR0(SR (*invokeAs)(void),
DR (*function)(A1,A2,A3),
AA1 a1, AA2 a2,AA3 a3)
template <class SR, class Callee, class DR>
RWTFunctorR0<SR> 
rwtMakeFunctorR0(SR (*invokeAs)(void), Callee& callee,
DR (Callee::*function)(void))
template <class SR, class Callee, class DR, 
class A1, class AA1> RWTFunctorR0<SR> rwtMakeFunctorR0(SR (*invokeAs)(void), Callee& callee,
DR (Callee::*function)(A1), AA1 a1)
template <class SR, class Callee, class DR, class A1, 
          class A2, class AA1, class AA2>
RWTFunctorR0<SR> 
rwtMakeFunctorR0(SR (*invokeAs)(void), Callee& callee,
DR (Callee::*function)(A1,A2), AA1 a1, AA2 a2)
template <class SR, class Callee, class DR, 
class A1, class A2, class A3, class AA1, class AA2, class AA3> RWTFunctorR0<SR> rwtMakeFunctorR0(SR(*invokeAs)(void), Callee& callee,
DR (Callee::*function)(A1,A2,A3),
AA1 a1, AA2 a2, AA3 a3)

Macros for Use With Global Functions

The macros in this section use the following naming conventions for the macro arguments:

rwtMakeFunctorR0G(SR,DR,function)
rwtMakeFunctorR0GA1(SR,DR,function,A1,a1)
rwtMakeFunctorR0GA2(SR,DR,function,A1,a1,A2,a2)
rwtMakeFunctorR0GA3(SR,DR,function,A1,a1,A2,a2,A3,a3)

Macros for Use With Member Functions

The macros in this section use the following naming conventions for the macro arguments:

rwtMakeFunctorR0M(SR,Callee,callee,DR,function) 
rwtMakeFunctorR0MA1(SR,Callee,callee,DR,function,A1,a1) 
rwtMakeFunctorR0MA2(SR,Callee,callee,DR,function,A1,a1,A2,a2) 
rwtMakeFunctorR0MA3(SR,Callee,callee,DR,function,
A1,a1,A2,a2,A3,a3)

See Also

RWTFunctorR0<SR>, RWTFunctorR0Imp<SR>



Previous fileTop of DocumentContentsIndex pageNext file

© Copyright Rogue Wave Software, Inc. All Rights Reserved.
Rogue Wave and SourcePro are registered trademarks of Rogue Wave Software, Inc. in the United States and other countries. All other trademarks are the property of their respective owners.
Contact Rogue Wave about documentation or support issues.