SourcePro® 2024.1 |
SourcePro® API Reference Guide |
Macros | |
#define | rwtMakeFunctorR1G(SR, S1, DR, function, D1) |
#define | rwtMakeFunctorR1GA1(SR, S1, DR, function, D1, A1, a1) |
#define | rwtMakeFunctorR1GA2(SR, S1, DR, function, D1, A1, a1, A2, a2) |
#define | rwtMakeFunctorR1M(SR, S1, Callee, callee, DR, function, D1) |
#define | rwtMakeFunctorR1MA1(SR, S1, Callee, callee, DR, function, D1, A1, a1) |
#define | rwtMakeFunctorR1MA2(SR, S1, Callee, callee, DR, function, D1, A1, a1, A2, a2) |
Functions | |
template<class SR , class S1 , class Callee , class DR , class D1 > | |
RWTFunctorR1< SR, S1 > | rwtMakeFunctorR1 (SR(*caller)(S1), Callee &callee, DR(Callee::*function)(D1)) |
template<class SR , class S1 , class Callee , class DR , class D1 , class A1 , class AA1 > | |
RWTFunctorR1< SR, S1 > | rwtMakeFunctorR1 (SR(*caller)(S1), Callee &callee, DR(Callee::*function)(D1, A1), AA1 a1) |
template<class SR , class S1 , class Callee , class DR , class D1 , class A1 , class A2 , class AA1 , class AA2 > | |
RWTFunctorR1< SR, S1 > | rwtMakeFunctorR1 (SR(*caller)(S1), Callee &callee, DR(Callee::*function)(D1, A1, A2), AA1 a1, AA2 a2) |
template<class SR , class S1 , class DR , class D1 > | |
RWTFunctorR1< SR, S1 > | rwtMakeFunctorR1 (SR(*caller)(S1), DR(*callee)(D1)) |
template<class SR , class S1 , class DR , class D1 , class A1 , class AA1 > | |
RWTFunctorR1< SR, S1 > | rwtMakeFunctorR1 (SR(*caller)(S1), DR(*callee)(D1, A1), AA1 a1) |
template<class SR , class S1 , class DR , class D1 , class A1 , class A2 , class AA1 , class AA2 > | |
RWTFunctorR1< SR, S1 > | rwtMakeFunctorR1 (SR(*caller)(S1), DR(*callee)(D1, A1, A2), AA1 a1, AA2 a2) |
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 rwtMakeFunctorR1() functions and macros are provided to construct functors based on the RWTFunctorR1 class. The RWTFunctorR1 class acts as the handle for a family of functor implementation classes based on the RWTFunctorR1Imp class. A functor based on RWTFunctorR1 is invoked with one argument and returns a value of type SR
, while the implementation classes can accept functions with up to two additional 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 rwtMakeFunctorR1() function or macro instantiates and constructs an appropriate functor implementation class instance and returns an RWTFunctorR1 handle that is bound to that instance.
rwtMakeFunctorR1() 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 rwtMakeFunctorR1(), 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 additional arguments. Otherwise we add one of A1
or A2
for functions with 1 or 2 additional arguments respectively. For example, you will use macro rwtMakeFunctorR1G() to create a functor that calls a global function that takes no additional arguments. The macro rwtMakeFunctorR1MA2() will create a functor that calls a member function that takes two additional arguments.
Example Using Templates
Example Using Macros
The macros in this section use the following naming conventions for the macro arguments:
SR | The actual type name to be used to instantiate the RWTFunctorR1. |
S1 | Type name of the first argument that will be expected when invoking the functor via RWTFunctorR1<SR,S1>::operator()(S1) . S1 must be convertible to D1 . |
DR | Type name of the function return value. DR must be convertible to SR . |
function | Global function pointer. |
A1 | Type name of the first argument. |
a1 | Expression that can be converted to an instance of A1 . |
A2 | Type name of the second argument. |
a2 | Expression that can be converted to an instance of A2 . |
s | Argument of type S1 that will be passed when invoking the functor. |
The macros in this section use the following naming conventions for the macro arguments:
SR | The actual type name to be used to instantiate the RWTFunctorR1. |
S1 | Type name of the first argument that will be expected when invoking the functor via RWTFunctorR1<SR,S1>::operator()(S1) . S1 must be convertible to D1 . |
Callee | Type name of the function's class. |
callee | Expression that results in a reference to a Callee instance. |
DR | Type name of the function return value. DR must be convertible to SR . |
function | Pointer to member function of class Callee |
D1 | Type name of the first argument of the function. |
A1 | Type name of the first argument. |
a1 | Expression that can be converted to an instance of A1 . |
A2 | Type name of the second argument. |
a2 | Expression that can be converted to an instance of A2 . |
s | Argument of type S1 that will be passed when invoking the functor. |
#define rwtMakeFunctorR1G | ( | SR, | |
S1, | |||
DR, | |||
function, | |||
D1 ) |
Macro to create an RWTFunctorR1 set to call function(s)
. function must have signature DR (*)(D1)
#define rwtMakeFunctorR1GA1 | ( | SR, | |
S1, | |||
DR, | |||
function, | |||
D1, | |||
A1, | |||
a1 ) |
Macro to create an RWTFunctorR1 set to call function(s,a1)
. function must have signature DR (*)(D1,A1)
#define rwtMakeFunctorR1GA2 | ( | SR, | |
S1, | |||
DR, | |||
function, | |||
D1, | |||
A1, | |||
a1, | |||
A2, | |||
a2 ) |
Macro to create an RWTFunctorR1 set to call function(s,a1,a2)
. function must have signature DR (*)(D1,A1,A2)
#define rwtMakeFunctorR1M | ( | SR, | |
S1, | |||
Callee, | |||
callee, | |||
DR, | |||
function, | |||
D1 ) |
Macro to create an RWTFunctorR1 set to call callee.function(s)
. function must have signature DR (Caller::*)(D1)
#define rwtMakeFunctorR1MA1 | ( | SR, | |
S1, | |||
Callee, | |||
callee, | |||
DR, | |||
function, | |||
D1, | |||
A1, | |||
a1 ) |
Macro to create an RWTFunctorR1 set to call callee.function(s,a1)
. function must have signature DR (Caller::*)(D1,A1)
#define rwtMakeFunctorR1MA2 | ( | SR, | |
S1, | |||
Callee, | |||
callee, | |||
DR, | |||
function, | |||
D1, | |||
A1, | |||
a1, | |||
A2, | |||
a2 ) |
Macro to create an RWTFunctorR1 set to call callee.function(s,a1,a2)
. function must have signature DR (Caller::*)(D1,A1,A2)
RWTFunctorR1< SR, S1 > rwtMakeFunctorR1 | ( | SR(* | caller )(S1), |
Callee & | callee, | ||
DR(Callee::* | function )(D1) ) |
Template function to create an RWTFunctorR1 set to call callee.function(s)
.
s
refers to the argument passed when invoking the functor via RWTFunctorR1<SR,S1>::operator()(S1)
. The argument will be passed through to the associated function.SR
. You may use any function with an appropriate signature or simply pass a NULL
pointer cast to the appropriate type as done in the example above.DR
must be convertible to SR
.S1
must be convertible to D1
. RWTFunctorR1< SR, S1 > rwtMakeFunctorR1 | ( | SR(* | caller )(S1), |
Callee & | callee, | ||
DR(Callee::* | function )(D1, A1), | ||
AA1 | a1 ) |
Template function to create an RWTFunctorR1 set to call callee.function(s, a1)
.
s
refers to the argument passed when invoking the functor via RWTFunctorR1<SR,S1>::operator()(S1)
. The argument will be passed through to the associated function.SR
. You may use any function with an appropriate signature or simply pass a NULL
pointer cast to the appropriate type as done in the example above.DR
must be convertible to SR
.S1
must be convertible to D1
.A1
. RWTFunctorR1< SR, S1 > rwtMakeFunctorR1 | ( | SR(* | caller )(S1), |
Callee & | callee, | ||
DR(Callee::* | function )(D1, A1, A2), | ||
AA1 | a1, | ||
AA2 | a2 ) |
Template function to create an RWTFunctorR1 set to call callee.function(s,a1,a2)
.
s
refers to the argument passed when invoking the functor via RWTFunctorR1<SR,S1>::operator()(S1)
. The argument will be passed through to the associated function.SR
. You may use any function with an appropriate signature or simply pass a NULL
pointer cast to the appropriate type as done in the example above.DR
must be convertible to SR
.S1
must be convertible to D1
.A1
and A2
respectively. RWTFunctorR1< SR, S1 > rwtMakeFunctorR1 | ( | SR(* | caller )(S1), |
DR(* | callee )(D1) ) |
Template function to create an RWTFunctorR1 set to call callee(s)
.
s
refers to the argument passed when invoking the functor via RWTFunctorR1<SR,S1>::operator()(S1)
. The argument will be passed through to the associated function.SR
. You may use any function with an appropriate signature or simply pass a NULL
pointer cast to the appropriate type as done in the example above.DR
must be convertible to SR
.S1
must be convertible to D1
. RWTFunctorR1< SR, S1 > rwtMakeFunctorR1 | ( | SR(* | caller )(S1), |
DR(* | callee )(D1, A1), | ||
AA1 | a1 ) |
Template function to create an RWTFunctorR1 set to call callee(s,a1)
.
s
refers to the argument passed when invoking the functor via RWTFunctorR1<SR,S1>::operator()(S1)
. The argument will be passed through to the associated function.SR
. You may use any function with an appropriate signature or simply pass a NULL
pointer cast to the appropriate type as done in the example above.DR
must be convertible to SR
.S1
must be convertible to D1
.A1
. RWTFunctorR1< SR, S1 > rwtMakeFunctorR1 | ( | SR(* | caller )(S1), |
DR(* | callee )(D1, A1, A2), | ||
AA1 | a1, | ||
AA2 | a2 ) |
Template function to create an RWTFunctorR1 set to call callee(s,a1,a2)
.
s
refers to the argument passed when invoking the functor via RWTFunctorR1<SR,S1>::operator()(S1)
. The argument will be passed through to the associated function.SR
. You may use any function with an appropriate signature or simply pass a NULL
pointer cast to the appropriate type as done in the example above.DR
must be convertible to SR
.S1
must be convertible to D1
.A1
and A2
respectively.
Copyright © 2024 Rogue Wave Software, Inc., a Perforce company. All Rights Reserved. |