SourcePro® API Reference Guide

 
Loading...
Searching...
No Matches
rwtMakeRunnableCallback Macros and Functions

Macros

#define rwtMakeRunnableCallbackG(function)
 
#define rwtMakeRunnableCallbackGA1(function, A1, a1)
 
#define rwtMakeRunnableCallbackGA2(function, A1, a1, A2, a2)
 
#define rwtMakeRunnableCallbackM(Callee, callee, function)
 
#define rwtMakeRunnableCallbackMA1(Callee, callee, function, A1, a1)
 
#define rwtMakeRunnableCallbackMA2(Callee, callee, function, A1, a1, A2, a2)
 

Functions

template<class Callee >
RWTFunctor2< const RWRunnable &, RWExecutionStaterwtMakeRunnableCallback (Callee &callee, void(Callee::*function)(const RWRunnable &, RWExecutionState))
 
template<class Callee , class A1 , class AA1 >
RWTFunctor2< const RWRunnable &, RWExecutionStaterwtMakeRunnableCallback (Callee &callee, void(Callee::*function)(const RWRunnable &, RWExecutionState, A1), AA1 a1)
 
template<class Callee , class A1 , class A2 , class AA1 , class AA2 >
RWTFunctor2< const RWRunnable &, RWExecutionStaterwtMakeRunnableCallback (Callee &callee, void(Callee::*function)(const RWRunnable &, RWExecutionState, A1, A2), AA1 a1, AA2 a2)
 
RWTFunctor2< const RWRunnable &, RWExecutionStaterwtMakeRunnableCallback (void(*function)(const RWRunnable &, RWExecutionState))
 
template<class A1 , class AA1 >
RWTFunctor2< const RWRunnable &, RWExecutionStaterwtMakeRunnableCallback (void(*function)(const RWRunnable &, RWExecutionState, A1), AA1 a1)
 
template<class A1 , class A2 , class AA1 , class AA2 >
RWTFunctor2< const RWRunnable &, RWExecutionStaterwtMakeRunnableCallback (void(*function)(const RWRunnable &, RWExecutionState, A1, A2), AA1 a1, AA2 a2)
 

Detailed Description

Header File
#include <rw/thread/rwtMakeRunnableCallback.h>

The rwtMakeRunnableCallback() helper functions and macros create functors that may be passed to the addCallback() method of an RWRunnableHandle. The functor may be created from functions that accept a constant RWRunnable reference as first argument, and an RWExecutionState as second argument, and that do not return a value.

rwtMakeRunnableCallback() 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 as 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 rwtMakeRunnableCallback, 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 rwtMakeRunnableCallbackG() to create a runnable that calls a global function that takes no arguments other than the runnable reference and the execution state. The macro rwtMakeRunnableCallbackMA2() will create a runnable that calls a member function that takes four arguments: the runnable reference and the execution state, plus two user-supplied arguments.

Example

Example Using Templates

// Global function with no additional arguments
void function(const RWRunnable&, RWExecutionState);
RWRunnableHandle rnb = ...;
// Create callback for function() and register with runnable
class A {
public:
// Member function with one additional argument
void bar(const RWRunnable&, RWExecutionState, int);
};
A a;
// Create callback for A::bar() and register with runnable
Base class from which all runnable object handles derive.
Definition RWRunnableHandle.h:210
void addCallback(const RWTFunctor< void(const RWRunnable &, RWExecutionState)> &functor, unsigned long stateMask, RWCallbackScope scope=RW_CALL_REPEATEDLY)
Handle class for a runnable object, i.e. one that controls an application's threads of execution.
Definition RWRunnable.h:106
RWTFunctor2< const RWRunnable &, RWExecutionState > rwtMakeRunnableCallback(void(*function)(const RWRunnable &, RWExecutionState))
Definition rwtMakeRunnableCallback.h:59
RWExecutionState
Definition RWRunnableHandle.h:47

Example Using Macros

// Create callback for function() and register with runnable
// Create callback for A::bar() and register with runnable
rnb.addCallback(rwtMakeRunnableCallbackMA1(A, a, &A::bar, int, 99));
#define rwtMakeRunnableCallbackG(function)
Definition rwtMakeRunnableCallback.h:38
#define rwtMakeRunnableCallbackMA1(Callee, callee, function, A1, a1)
Definition rwtMakeRunnableCallback.h:197

Macros (for Use With Global Functions)

The macros in this section use the following naming conventions for the macro arguments:

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.

Macros (for Use With Member Functions)

The macros in this section use the following naming conventions for the macro arguments:

Callee Type name of the function's class.
callee Expression that results in a reference to a Callee instance.
function Pointer to member function of class Callee
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.
See also
RWRunnableHandle, RWTFunctor2

Macro Definition Documentation

◆ rwtMakeRunnableCallbackG

#define rwtMakeRunnableCallbackG ( function)
Deprecated
As of SourcePro 12.5, use rwBind(function, rw1, rw2) instead.

Macro to create a runnable callback functor from a global function that takes a runnable reference and an execution state as arguments.

◆ rwtMakeRunnableCallbackGA1

#define rwtMakeRunnableCallbackGA1 ( function,
A1,
a1 )
Deprecated
As of SourcePro 12.5, use rwBind(function, rw1, rw2, a1) instead.

Macro to create a runnable callback functor from a global function that takes a runnable reference, an execution state, and one additional argument.

◆ rwtMakeRunnableCallbackGA2

#define rwtMakeRunnableCallbackGA2 ( function,
A1,
a1,
A2,
a2 )
Deprecated
As of SourcePro 12.5, use rwBind(function, rw1, rw2, a1, a2) instead.

Macro to create a runnable callback functor from a global function that takes a runnable reference, an execution state, and two additional arguments.

◆ rwtMakeRunnableCallbackM

#define rwtMakeRunnableCallbackM ( Callee,
callee,
function )
Deprecated
As of SourcePro 12.5, use rwBind(function, callee, rw1, rw2) instead.

Macro to create a runnable callback functor from a member function that takes a runnable reference and an execution state as arguments.

◆ rwtMakeRunnableCallbackMA1

#define rwtMakeRunnableCallbackMA1 ( Callee,
callee,
function,
A1,
a1 )
Deprecated
As of SourcePro 12.5, use rwBind(function, callee, rw1, rw2, a1) instead.

Macro to create a runnable callback functor from a global function that takes a runnable reference, an execution state, and one additional argument.

◆ rwtMakeRunnableCallbackMA2

#define rwtMakeRunnableCallbackMA2 ( Callee,
callee,
function,
A1,
a1,
A2,
a2 )
Deprecated
As of SourcePro 12.5, use rwBind(function, callee, rw1, rw2, a1, a2) instead.

Macro to create a runnable callback functor from a global function that takes a runnable reference, an execution state, and two additional arguments.

Function Documentation

◆ rwtMakeRunnableCallback() [1/6]

template<class Callee >
RWTFunctor2< const RWRunnable &, RWExecutionState > rwtMakeRunnableCallback ( Callee & callee,
void(Callee::* function )(const RWRunnable &, RWExecutionState) )
Deprecated
As of SourcePro 12.5, use rwBind(function, callee, rw1, rw2) instead.

Template function to create a runnable callback functor from a member function that takes a runnable reference and an execution state as arguments.

◆ rwtMakeRunnableCallback() [2/6]

template<class Callee , class A1 , class AA1 >
RWTFunctor2< const RWRunnable &, RWExecutionState > rwtMakeRunnableCallback ( Callee & callee,
void(Callee::* function )(const RWRunnable &, RWExecutionState, A1),
AA1 a1 )
Deprecated
As of SourcePro 12.5, use rwBind(function, callee, rw1, rw2, a1) instead.

Template function to create a runnable callback functor from a global function that takes the runnable reference, the execution state, and one additional argument. a1 must be convertible to an instance of A1.

◆ rwtMakeRunnableCallback() [3/6]

template<class Callee , class A1 , class A2 , class AA1 , class AA2 >
RWTFunctor2< const RWRunnable &, RWExecutionState > rwtMakeRunnableCallback ( Callee & callee,
void(Callee::* function )(const RWRunnable &, RWExecutionState, A1, A2),
AA1 a1,
AA2 a2 )
Deprecated
As of SourcePro 12.5, use rwBind(function, callee, rw1, rw2, a1, a2) instead.

Template function to create a runnable callback functor from a global function that takes the runnable reference, the execution state, and two additional arguments. a1 and a2 must be convertible to instances of types A1 and A2 respectively.

◆ rwtMakeRunnableCallback() [4/6]

RWTFunctor2< const RWRunnable &, RWExecutionState > rwtMakeRunnableCallback ( void(* function )(const RWRunnable &, RWExecutionState))
inline
Deprecated
As of SourcePro 12.5, use rwBind(function, rw1, rw2) instead.

Template function to create a runnable callback functor from a global function that takes a runnable reference and an execution state as arguments.

◆ rwtMakeRunnableCallback() [5/6]

template<class A1 , class AA1 >
RWTFunctor2< const RWRunnable &, RWExecutionState > rwtMakeRunnableCallback ( void(* function )(const RWRunnable &, RWExecutionState, A1),
AA1 a1 )
Deprecated
As of SourcePro 12.5, use rwBind(function, rw1, rw2, a1) instead.

Template function to create a runnable callback functor from a global function that takes the runnable reference, the execution state, and one additional argument. a1 must be convertible to an instance of type A1.

◆ rwtMakeRunnableCallback() [6/6]

template<class A1 , class A2 , class AA1 , class AA2 >
RWTFunctor2< const RWRunnable &, RWExecutionState > rwtMakeRunnableCallback ( void(* function )(const RWRunnable &, RWExecutionState, A1, A2),
AA1 a1,
AA2 a2 )
Deprecated
As of SourcePro 12.5, use rwBind(function, rw1, rw2, a1, a2) instead.

Template function to create a runnable callback functor from a global function that takes the runnable reference, the execution state, and two additional arguments. a1 and a2 must be convertible to instances of types A1 and A2 respectively.

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