RWTFunctorR2Imp<SR,S1,S2> RWBodyBase RWTFunctorR2<SR,S1,S2> Implementation Classes RWTFunctorR2Imp<SR,S1,S2>
#include <rw/functor/RWTFunctorR2Imp.h> #include <rw/functor/RWTFunctorR2GImp.h> #include <rw/functor/RWTFunctorR2GA1Imp.h> #include <rw/functor/RWTFunctorR2GA2Imp.h> #include <rw/functor/RWTFunctorR2MImp.h> #include <rw/functor/RWTFunctorR2MA1Imp.h> #include <rw/functor/RWTFunctorR2MA2Imp.h>
A function object, or a 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.
RWTFunctorR2Imp is the abstract base class for the family of functor bodies that are invoked with two arguments and return a value.
The make() function is the only member of these functor classes that is intended to be accessed directly; it is often called through one of the rwtMakeFunctor0() convenience mechanisms. All other members must be accessed through an RWFunctor0 handle.
Each derived class name appends either a G (for global) or an M (for member), to indicate whether or not it is invoked upon an object. Static member functions use the G version, since there is no object associated with the call.
The class name may also append A1 or A2 to indicate that it takes callee arguments at construction time. These arguments are stored and added to the caller argument at invocation time.
The 6 concrete class names are:
RWTFunctorR2GImp<SR,S1,S2,DR,D1,D2> | No this object, no callee arguments |
RWTFunctorR2GA1Imp<SR,S1,S2,DR,D1,D2,A1> | No this object, one callee argument |
RWTFunctorR2GA2Imp<SR,S1,S2,DR,D1,D2,A1,A2> | No this object, two callee arguments |
RWTFunctorR2MImp<SR,S1,S2,Callee,DR,D1,D2> | Has this object, but no callee arguments |
RWTFunctorR2MA1Imp<SR,S1,S2,Callee,DR,D1,D2,A1> | Has this object, and one callee argument |
RWTFunctorR2MA2Imp<SR,S1,S2,Callee,DR,D1,D2,A1,A2> | Has this object, and two callee arguments |
These concrete classes are templatized on the signature of the function that is encapsulated, as well as the signature of the functor invocation.
The template parameters describe the invocation signature of the functor and the function call it encapsulates. These parameters are:
SR | The return type of the functor |
S1 | The type of the first functor signature argument |
S2 | The type of the second functor signature argument |
Callee | The class type that declares a member function |
DR | The return type of the function; the compiler must be able to convert this to the SR type |
D1 | The type of the first function signature argument; the compiler must be able to convert to this from the S1 type |
D2 | The type of the second function signature argument; the compiler must be able to convert to this from the S2 type |
A1 | The type of the first client data argument |
A2 | The type of the second client data argument |
#include <rw/functor/RWTFunctorR2GImp.h> int foo(int,float); // Create a functor that calls foo(): RWTFunctorR2<int,int,float> func; func = RWTFunctorR2GImp<int,int,float,int,int,float>::make(foo); // Invoke functor int result = func(7,0.5);
typedef DR (*CalleeSignature)(D1,D2);
In RWTFunctorR2GImp<SR,S1,S2,DR,D1,D2>.
typedef DR (*CalleeSignature)(D1,D2,A1);
In RWTFunctorR2GA1Imp<SR,S1,S2,DR,D1,D2,A1>.
typedef DR (*CalleeSignature)(D1,D2,A1,A2);
In RWTFunctorR2GA2Imp<SR,S1,S2,DR,D1,D2,A1,A2>.
typedef DR (Callee::*CalleeSignature)(D1,D2);
In RWTFunctorR2MImp<SR,S1,S2,Callee,DR,D1,D2>.
typedef DR (Callee::*CalleeSignature)(D1,D2,A1);
In RWTFunctorR2MA1Imp<SR,S1,S2,Callee,DR,D1,D2,A1>.
typedef DR (Callee::*CalleeSignature)(D1,D2,A1,A2);
In RWTFunctorR2MA2Imp<SR,S1,S2,Callee,DR,D1,D2,A1,A2>.
static RWTFunctorR2<SR,S1,S2> RWTFunctorR2GImp<SR,S1,S2,DR,D1,D2>:: make(CalleeSignature function);
static RWTFunctorR2<SR,S1,S2> RWTFunctorR2GA1Imp<SR,S1,S2,DR,D1,D2,A1>:: make(CalleeSignature function, A1 a1);
static RWTFunctorR2<SR,S1,S2> RWTFunctorR2GA2Imp<SR,S1,S2,DR,D1,D2,A1,A2>:: make(CalleeSignature function, A1 a1, A2 a2);
static RWTFunctorR2<SR,S1,S2> RWTFunctorR2MImp<SR,S1,S2,Callee,DR,D1,D2>:: make(Callee& callee, CalleeSignature function);
static RWTFunctorR2<SR,S1,S2> RWTFunctorR2MA1Imp<SR,S1,S2,Callee,DR,D1,D2,A1>:: make(Callee& callee, CalleeSignature function, A1 a1);
static RWTFunctorR2<SR,S1,S2> RWTFunctorR2MA2Imp<SR,S1,S2,Callee,DR,D1,D2,A1,A2>:: make(Callee& callee, CalleeSignature function, A1 a1, A2 a2);
These make() functions dynamically construct an instance of the corresponding implementation class and bind it to the returned RWTFunctorR2<SR,S1,S2> handle instance.
rwtMakeFunctorR2, RWTFunctorR2<SR,S1,S2>
©Copyright 2000, Rogue Wave Software, Inc.
Contact Rogue Wave about documentation or support issues.