SourcePro® API Reference Guide

 
Loading...
Searching...
No Matches
RWTFunctorR1Imp< SR, S1 > Class Template Reference

Deprecated. Abstract base class for the family of functor bodies that are invoked with one caller argument and return a value. More...

#include <rw/functor/RWTFunctorR1Imp.h>

Inherits RWTFunctorImpBase1< SR, S1 >.

Inherited by RWTFunctorR1GA1Imp< SR, S1, DR, D1, A1 >, RWTFunctorR1GA2Imp< SR, S1, DR, D1, A1, A2 >, RWTFunctorR1GImp< SR, S1, DR, D1 >, RWTFunctorR1MA1Imp< SR, S1, Callee, DR, D1, A1 >, RWTFunctorR1MA2Imp< SR, S1, Callee, DR, D1, A1, A2 >, and RWTFunctorR1MImp< SR, S1, Callee, DR, D1 >.

Detailed Description

template<class SR, class S1>
class RWTFunctorR1Imp< SR, S1 >
Deprecated
As of SourcePro 12.5, use RWTFunctor<SR(S1)> instead.

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.

RWTFunctorR1Imp is the abstract base class for the family of functor bodies that take one caller argument at invocation time and return a value.

Each derived class name appends either aG (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 argument at invocation time.

The six concrete class names are:

  • RWTFunctorR1GImp<SR,S1,DR,D1>
    • No this object, no callee arguments
  • RWTFunctorR1GA1Imp<SR,S1,DR,D1,A1>
    • No this object, one callee argument
  • RWTFunctorR1GA2Imp<SR,S1,DR,D1,A1,A2>
    • No this object, two callee arguments
  • RWTFunctorR1MImp<SR,S1,Callee,DR,D1>
    • Has this object, but no callee arguments
  • RWTFunctorR1MA1Imp<SR,S1,Callee,D1,DR,A1>
    • Has this object, and one callee argument
  • RWTFunctorR1MA2Imp<SR,S1,Callee,DR,D1,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 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:

  • SR      The return type of the functor
  • S1      The type of the first 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
  • A1      The type of the first client data argument
  • A2      The type of the second client data argument

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 rwtMakeFunctorR1() convenience mechanisms. All other members must be accessed through an RWTFunctorR1 handle.

Example
#include <rw/functor/RWTFunctorR1GImp.h>
int foo(float);
int main(void) {
// Create a functor that calls foo():
func = RWTFunctorR1GImp<int, float, int, float>::make(foo);
// Invoke Functor
int result = func(7.0);
return 0;
}
Deprecated. Represents the group of functors that are invoked with one argument, and whose invocation...
Definition RWTFunctorR1.h:134
See also
rwtMakeFunctorR1(), RWTFunctorR1

Copyright © 2024 Rogue Wave Software, Inc., a Perforce company. All Rights Reserved.