Module: Threads Package: Functor
RWFunctor0Imp RWBodyBase RWFunctor0Implementation Classes RWFunctor0Imp
#include <rw/functor/RWFunctor0Imp.h> #include <rw/functor/RWTFunctor0GImp.h> #include <rw/functor/RWTFunctor0GA1Imp.h> #include <rw/functor/RWTFunctor0GA2Imp.h> #include <rw/functor/RWTFunctor0GA3Imp.h> #include <rw/functor/RWTFunctor0MImp.h> #include <rw/functor/RWTFunctor0MA1Imp.h> #include <rw/functor/RWTFunctor0MA2Imp.h> #include <rw/functor/RWTFunctor0MA3Imp.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.
Class RWFunctor0Imp is the abstract base class for functor bodies that are invoked with no caller arguments and return no value. These functor classes can accept up to three client data arguments at construction time, which are passed to the function each time the functor is invoked.
The make() function is the only member of these 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, A2, or A3, to indicate that it takes callee arguments at construction time. These arguments are stored in the functor body and passed to the function at invocation time.
The eight concrete class names are:
RWTFunctor0GImp <DR>
No this object, no callee arguments
RWTFunctor0GA1Imp<DR,A1>
No this object, one callee argument
RWTFunctor0GA2Imp<DR,A1,A2>
No this object, two callee arguments
RWTFunctor0GA3Imp<DR,A1,A2,A3>
No this object, three callee arguments
RWTFunctor0MImp<Callee,DR>
Has this object, but no callee arguments
RWTFunctor0MA1Imp<Callee,DR,A1>
Has this object, and one callee argument
RWTFunctor0MA2Imp<Callee,DR,A1,A2>
Has this object, and two callee arguments
RWTFunctor0MA3Imp<Callee,DR,A1,A2,A3>
Has this object, and three callee arguments
These concrete classes are templatized on the signature of the function that is encapsulated, as well as on 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:
Callee |
The class type that declares a member function |
DR |
The return type of the function |
A1 |
The type of the first client data argument |
A2 |
The type of the second client data argument |
A3 |
The type of the third client data argument |
#include <rw/functor/RWTFunctor0GA1Imp.h> void foo(int); // Create a functor that calls foo(7): RWFunctor0 func = RWTFunctor0GA1Imp<void,int>::make(foo,7); // Invoke Functor func();
typedef DR (*CalleeSignature)();
In RWTFunctor0GImp<DR>.
typedef DR (*CalleeSignature)(A1);
In RWTFunctor0GA1Imp<DR,A1>.
typedef DR (*CalleeSignature)(A1,A2);
In RWTFunctor0GA2Imp<DR,A1,A2>.
typedef DR (*CalleeSignature)(A1,A2,A3);
In RWTFunctor0GA3Imp<DR,A1,A2,A3>.
typedef DR (Callee::*CalleeSignature)();
In RWTFunctor0MImp<Callee,DR>.
typedef DR (Callee::*CalleeSignature)(A1);
In RWTFunctor0MA1Imp<Callee,DR,A1>.
typedef DR (Callee::*CalleeSignature)(A1,A2);
In RWTFunctor0MA2Imp<Callee,DR,A1,A2>.
typedef DR (Callee::*CalleeSignature)(A1,A2,A3);
In RWTFunctor0MA3Imp<Callee,DR,A1,A2,A3>.
static RWFunctor0 RWTFunctor0GImp<DR>:: make(CalleeSignature function); static RWFunctor0 RWTFunctor0GA1Imp<DR,A1>:: make(CalleeSignature function, A1 a1); static RWFunctor0 RWTFunctor0GA2Imp<DR,A1,A2>:: make(CalleeSignature function, A1 a1, A2 a2); static RWFunctor0 RWTFunctor0GA3Imp<DR,A1,A2,A3>:: make(CalleeSignature function, A1 a1, A2 a2, A3 a3); static RWFunctor0 RWTFunctor0MImp<Callee,DR>:: make(Callee& callee, CalleeSignature function); static RWFunctor0 RWTFunctor0MA1Imp<Callee,DR,A1>:: make(Callee& callee, CalleeSignature function, A1 a1); static RWFunctor0 RWTFunctor0MA2Imp<Callee,DR,A1,A2>:: make(Callee& callee, CalleeSignature function, A1 a1, A2 a2); static RWFunctor0 RWTFunctor0MA3Imp<Callee,DR,A1,A2,A3>:: make(Callee& callee, CalleeSignature function, A1 a1, A2 a2, A3 a3);
These make() functions dynamically construct an instance of the corresponding implementation class and bind it to the returned RWFunctor0 handle instance.
© 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.