Rogue Wave banner
Previous fileTop of DocumentContentsIndex pageNext file
Threads Module Reference Guide
Rogue Wave web site:  Home Page  |  Main Documentation Page

2.4 Functor Package

2.4.1 Description

The Function package includes two subpackages, Functor List and Functor Map. For complete information about the Functor package, see Chapter 8 of the Threads Module User's Guide.

2.4.2 Functor Class Hierarchy

The Functor package contains a large family of template classes designed to accommodate global, static, and member function calls with varying numbers of arguments, as shown in Figure 2 and Figure 3. Like many other Threads Module packages, the Functor package uses the handle-body idiom. In the hierarchies, the handle classes are on the left and the matching sets of body classes are on the right.

Figure 2: Hierarchy of functor classes for functions whose return values are ignored

Figure 3: Hierarchy of functor classes for functions with return values

2.4.3 Functor List Class Hierarchy

The Functor List subpackage is made up of classes designed for creating functors which are themselves lists of functors to be invoked in turn. Functor list classes are an extension to the functor class hierarchy, as shown in Figure 4.

Figure 4: Hierarchy of functor list classes and the functor classes from which they derive

Class names are constructed from the base name RWTFunctorList for templatized classes or RWFunctorList for the few non-templatized classes by adding 0, 1 or 2 for the number of caller arguments.

The formal template parameters (shown in the hierarchy) include:

S1 -- The type of the functor list's first argument.

S2 -- The type of the functor list's second argument.


NOTE -- Functor lists do not provide R0, R1, or R2 classes.

2.4.4 Functor Map Class Hierarchy

The Functor Map subpackage is made up of classes designed for creating functors which are themselves a collection of functors, one of which is to be invoked according to a given key. Functor map classes are an extension to the functor class hierarchy, as shown in Figure 5.

Figure 5: Hierarchy of functor map classes and the functor classes from which they derivr

Class names are constructed from the base name RWTFunctorMap by adding 1 or 2 for the number of caller arguments and an optional R if the map returns a value. Because every functor map invocation requires a key, there is no RWTFunctorMap0.

The formal template parameters (shown in the hierarchy) include:

SR -- The type of the functor map's return value

Key -- The type of the functor map's key (which is the functor map's first argument)

S1 -- The type of the encapsulated functor's first argument (which is the functor map's second argument)

2.4.5 Index of Classes

Table 2 contains an alphabetical listing of the public classes and global functions and macros in the Functor package.

Table 2: Index of Functor Classes 

Class Name Description

RWFunctor0

The handle class for functors that are invoked without any caller arguments, and whose invocation returns no value.

RWFunctor0Imp

The abstract base class for functor bodies that are invoked without any caller arguments, and whose invocation returns no value.

RWTFunctor1<S1>

The handle class for functors that are invoked with one caller argument.

RWTFunctor1Imp<S1>

The abstract base class for functor bodies that are invoked with one caller argument.

RWTFunctor2<S1,S2>

The handle class for functors that are invoked with two caller arguments.

RWTFunctor2Imp<S1,S2>

The abstract base class for functor bodies that are invoked with two caller arguments.

RWTFunctorR0<SR>

The handle class for functor bodies that are invoked with no caller arguments and return a value.

RWTFunctorR0Imp<SR>

The abstract base class for functor bodies that are invoked with no caller arguments and return a value.

RWTFunctorR1<SR,S1>

The handle class for functor bodies that are invoked with one caller argument and return a value.

RWTFunctorR1Imp<SR,S1>

The abstract base class for functor bodies that are invoked with one caller argument and return a value.

RWTFunctorR2<SR,S1,S2>

The handle class for functors that are invoked with two caller arguments and that return a value.

RWTFunctorR2Imp <SR,S1,S2>

The abstract base class for functor bodies that are invoked with two caller arguments and return a value.

rwtMakeFunctor0()

Creates an instance of RWFunctor0 from a global or member function pointer.

rwtMakeFunctor1()

Creates an instance of RWFunctor1<S1> from a global or member function pointer.

rwtMakeFunctor2()

Creates an instance of RWFunctor2<S1,S2> from a global or member function pointer.

rwtMakeFunctorR0()

Creates an instance of RWFunctorR0<SR> from a global or member function pointer.

rwtMakeFunctorR1()

Creates an instance of RWFunctorR1<SR,S1> from a global or member function pointer.

rwtMakeFunctorR2()

Creates an instance of RWFunctorR2<SR,S1,S2> from a global or member function pointer.

Table 3 lists the public classes in the Functor List package.

Table 3: Index of Functor List classes 

Class Name Description

RWCallbackScope

Used when adding a callback functor to a callback list.

RWFunctorList0

The functor list class that is invoked with no caller arguments.

RWTFunctorList1

The functor list class that is invoked with one caller argument.

RWTFunctorList2

The functor list class that is invoked with two caller arguments.

Table 4 lists the public classes in the Functor Map package.

Table 4: Index of Functor Map classes

Class Name Description

RWTFunctorMap1

The functor map class that takes one argument at invocation, and returns no value.

RWTFunctorMap2

The functor map class that takes two arguments at invocation, and returns no value.

RWTFunctorMapR1

The functor map class that takes one argument at invocation, and returns a value.

RWTFunctorMapR2

The functor map class that takes two arguments at invocation, and returns a value.



Previous fileTop of DocumentContentsIndex pageNext file

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