SourcePro® API Reference Guide

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

Deprecated. Represents the group of functors that are invoked with two arguments, and whose invocation returns a value. More...

#include <rw/functor/RWTFunctorR2.h>

Inherits RWTFunctor< T >.

Public Types

typedef SR(* CallerSignature) (S1, S2)
 
typedef S1 S1Type
 
typedef S2 S2Type
 
typedef SR SRType
 

Public Member Functions

 RWTFunctorR2 (const RWTFunctor< SR(S1, S2)> &second)
 
 RWTFunctorR2 (const RWTFunctorR2< SR, S1, S2 > &second)
 
 RWTFunctorR2 (RWStaticCtor)
 
 RWTFunctorR2 (RWTFunctorR2Imp< SR, S1, S2 > *functorImp)
 
 RWTFunctorR2 (void)
 
 ~RWTFunctorR2 (void)
 
RWTFunctorR2Imp< SR, S1, S2 > & body (void) const
 
RWTFunctorR2< SR, S1, S2 > & operator= (const RWTFunctor< SR(S1, S2)> &second)
 
RWTFunctorR2< SR, S1, S2 > & operator= (const RWTFunctorR2< SR, S1, S2 > &second)
 

Detailed Description

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

RWTFunctorR2 represents the group of functors that are invoked with two arguments, and whose invocation returns a value.

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.

Instances of RWTFunctorR2 act as handles to functor implementations or bodies. Such implementations are created by using either the rwtMakeFunctorR2() global functions or macros. Each of these methods creates a new body instance, and returns the handle to that instance. See the example below.

Note that although an instance of this class is invoked with two arguments, the encapsulated function may have more arguments.

The additional arguments to be passed to the encapsulated function are provided to the functor at the time of creation. They are stored within the functor object, and are retrieved at the time of invocation.

Example
#include <rw/functor/functorR2.h>
long foo(int i, short s) { return (long)i + s; }
int main() {
// Create a handle, and assign a new body to it.
rwtMakeFunctorR2((long (*)(int, short))0, foo);
// Invoke the functor with two caller arguments.
long return_value = functor(42, 3);
return 0;
}
Deprecated. Represents the group of functors that are invoked with two arguments, and whose invocatio...
Definition RWTFunctorR2.h:126
RWTFunctorR2< SR, S1, S2 > rwtMakeFunctorR2(SR(*caller)(S1, S2), DR(*callee)(D1, D2))
Definition rwtMakeFunctorR2.h:80
See also
rwtMakeFunctorR2()

Member Typedef Documentation

◆ CallerSignature

template<class SR , class S1 , class S2 >
typedef SR(* RWTFunctorR2< SR, S1, S2 >::CallerSignature) (S1, S2)

The signature of the functor invocation.

◆ S1Type

template<class SR , class S1 , class S2 >
typedef S1 RWTFunctorR2< SR, S1, S2 >::S1Type

The type of the first caller argument.

◆ S2Type

template<class SR , class S1 , class S2 >
typedef S2 RWTFunctorR2< SR, S1, S2 >::S2Type

The type of the second caller argument.

◆ SRType

template<class SR , class S1 , class S2 >
typedef SR RWTFunctorR2< SR, S1, S2 >::SRType

The type of the functor's return value.

Constructor & Destructor Documentation

◆ ~RWTFunctorR2()

template<class SR , class S1 , class S2 >
RWTFunctorR2< SR, S1, S2 >::~RWTFunctorR2 ( void )

Destructor.

◆ RWTFunctorR2() [1/5]

template<class SR , class S1 , class S2 >
RWTFunctorR2< SR, S1, S2 >::RWTFunctorR2 ( void )

Constructs an empty, invalid, handle instance. To create a viable handle, use the rwtMakeFunctor1() global functions or macros.

◆ RWTFunctorR2() [2/5]

template<class SR , class S1 , class S2 >
RWTFunctorR2< SR, S1, S2 >::RWTFunctorR2 ( RWStaticCtor )

Constructs a global static handle instance. Constructor does not reset any values that may have been set in invocations prior to the constructor call.

◆ RWTFunctorR2() [3/5]

template<class SR , class S1 , class S2 >
RWTFunctorR2< SR, S1, S2 >::RWTFunctorR2 ( RWTFunctorR2Imp< SR, S1, S2 > * functorImp)

Body constructor. Binds a new handle instance to an existing functor body instance.

◆ RWTFunctorR2() [4/5]

template<class SR , class S1 , class S2 >
RWTFunctorR2< SR, S1, S2 >::RWTFunctorR2 ( const RWTFunctorR2< SR, S1, S2 > & second)

Copy constructor. Binds a new handle instance to the functor body instance, if any, associated with the second handle instance.

◆ RWTFunctorR2() [5/5]

template<class SR , class S1 , class S2 >
RWTFunctorR2< SR, S1, S2 >::RWTFunctorR2 ( const RWTFunctor< SR(S1, S2)> & second)

Conversion constructor. Binds a new handle instance to the functor body instance, if any, associated with the second handle instance.

Member Function Documentation

◆ body()

template<class SR , class S1 , class S2 >
RWTFunctorR2Imp< SR, S1, S2 > & RWTFunctorR2< SR, S1, S2 >::body ( void ) const
inline

Gets a reference for the body instance, if any, otherwise throws an exception.

Exceptions
RWTHRInvalidPointerThrown if the handle has no associated body.
std::bad_castThrown if the body is not of type RWTFunctorR2Imp.

◆ operator=() [1/2]

template<class SR , class S1 , class S2 >
RWTFunctorR2< SR, S1, S2 > & RWTFunctorR2< SR, S1, S2 >::operator= ( const RWTFunctor< SR(S1, S2)> & second)

Assignment operator. Detaches this handle instance from any functor body instance it currently references, and binds it to the functor body instance, if any, associated with the second handle instance.

◆ operator=() [2/2]

template<class SR , class S1 , class S2 >
RWTFunctorR2< SR, S1, S2 > & RWTFunctorR2< SR, S1, S2 >::operator= ( const RWTFunctorR2< SR, S1, S2 > & second)

Assignment operator. Detaches this handle instance from any functor body instance it currently references, and binds it to the functor body instance, if any, associated with the second handle instance.

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