rwlogo
SourcePro 11.1

SourcePro® C++ API Reference Guide



   SourcePro C++
Documentation Home

RWTFunctor2Imp< S1, S2 > Class Template Reference
[Functors]

Abstract base class for the family of functor bodies that are invoked with two caller arguments and whose invocation returns no value. More...

#include <rw/functor/RWTFunctor2Imp.h>

Inheritance diagram for RWTFunctor2Imp< S1, S2 >:
RWBodyBase RWTCountingBody< RWMutexLock > RWTMonitor< RWMutexLock >

List of all members.


Detailed Description

template<class S1, class S2>
class RWTFunctor2Imp< S1, S2 >

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

RWTFunctor2Imp<S1,S2> is the abstract base class for the family of functor bodies that are invoked with two caller arguments, and whose invocation returns no value.

Each derived class name appends either a G (for global) or an M (for member), to indicate whether 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 arguments at invocation time.

The six concrete class names are:

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:

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 rwtMakeFunctor2() convenience mechanisms. All other members must be accessed through an RWTFunctor2<S1,S2> handle.

Examples

 #include <rw/functor/RWTFunctor2GImp.h>
 
 void foo(int,float);
 
 // Create a functor that calls foo():
 RWTFunctor2<int,float> func;
 func = RWTFunctor2GImp<int,float,void,int,float>::make(foo);
 // Invoke functor
 func(7,1.0);
See also:
rwtMakeFunctor2(), RWTFunctor2<S1,S2>

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