SourcePro® API Reference Guide

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

Macros

#define rwtMakeRunnableGuardG(DR, function)
 
#define rwtMakeRunnableGuardGA1(DR, function, A1, a1)
 
#define rwtMakeRunnableGuardGA2(DR, function, A1, a1, A2, a2)
 
#define rwtMakeRunnableGuardGA3(DR, function, A1, a1, A2, a2, A3, a3)
 
#define rwtMakeRunnableGuardM(Callee, callee, DR, function)
 
#define rwtMakeRunnableGuardMA1(Callee, callee, DR, function, A1, a1)
 
#define rwtMakeRunnableGuardMA2(Callee, callee, DR, function, A1, a1, A2, a2)
 
#define rwtMakeRunnableGuardMA3(Callee, callee, DR, function, A1, a1, A2, a2, A3, a3)
 

Functions

template<class Callee , class DR , class A1 , class AA1 >
RWRunnableGuard rwtMakeRunnableGuard (Callee &callee, DR(Callee::*function)(A1), AA1 a1)
 
template<class Callee , class DR , class A1 , class AA1 , class A2 , class AA2 >
RWRunnableGuard rwtMakeRunnableGuard (Callee &callee, DR(Callee::*function)(A1, A2), AA1 a1, AA2 a2)
 
template<class Callee , class DR , class A1 , class AA1 , class A2 , class AA2 , class A3 , class AA3 >
RWRunnableGuard rwtMakeRunnableGuard (Callee &callee, DR(Callee::*function)(A1, A2, A3), AA1 a1, AA2 a2, AA3 a3)
 
template<class Callee , class DR >
RWRunnableGuard rwtMakeRunnableGuard (Callee &callee, DR(Callee::*function)(void))
 
template<class DR , class A1 , class AA1 >
RWRunnableGuard rwtMakeRunnableGuard (DR(*function)(A1), AA1 a1)
 
template<class DR , class A1 , class A2 , class AA1 , class AA2 >
RWRunnableGuard rwtMakeRunnableGuard (DR(*function)(A1, A2), AA1 a1, AA2 a2)
 
template<class DR , class A1 , class A2 , class A3 , class AA1 , class AA2 , class AA3 >
RWRunnableGuard rwtMakeRunnableGuard (DR(*function)(A1, A2, A3), AA1 a1, AA2 a2, AA3 a3)
 
template<class DR >
RWRunnableGuard rwtMakeRunnableGuard (DR(*function)(void))
 

Detailed Description

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

An RWRunnableGuard is a typedef to a functor used in conjunction with the RWTPCValBufferBaseGuarded and derived classes, templatized on a RWRunnable. The runnable server classes RWRunnableServer and RWServerPool use these functors internally. A runnable guard functor is used by the RWTPCValBufferBaseGuarded classes to select the next enqueued runnable to execute. It is designed to allow a runnable to remain in a queue until some condition is satisfied.

When a client requests a runnable from a runnable queue, the queue selects the next runnable to execute by traversing any enqueued runnables, and executing their guard functors, until it finds a runnable whose guard functor evaluates to true. That runnable is then returned to the client.

Example
#include <rw/thread/RWRunnableFunction.h>
#include <rw/thread/RWRunnableGuard.h>
#include <rw/thread/RWRunnableServer.h>
#include <rw/thread/rwtMakeRunnableFunction.h>
#include <iostream>
void something() { std::cout << "I'm a runnable" << std::endl; }
class YourClass {
public:
bool yourFunc() {
if ( //some condition
) {
return true;
} else {
return false;
}
}
};
int main() {
runnableServer.start();
RWRunnableFunction doSomething;
doSomething = rwtMakeRunnableFunction(something);
YourClass yourClass;
// Construct a guard functor using a template function.
RWRunnableGuard guard1;
guard1 = rwtMakeRunnableGuard(yourClass, &YourClass::yourFunc);
runnableServer.enqueue(doSomething, guard1);
// Construct a guard functor using a macro.
RWRunnableGuard guard2;
guard2 = rwtMakeRunnableGuardM(YourClass, yourClass, bool,
&YourClass::yourFunc);
runnableServer.enqueue(doSomething, guard2);
runnableServer.stop();
runnableServer.join();
return 0;
}
Handle class for functor-based, runnable objects.
Definition RWRunnableFunction.h:86
Represents a runnable server for executing runnable objects.
Definition RWRunnableServer.h:137
static RWRunnableServer make()
RWRunnableFunction rwtMakeRunnableFunction(R(*function)(void))
Definition rwtMakeRunnableFunction.h:56
#define rwtMakeRunnableGuardM(Callee, callee, DR, function)
Definition rwtMakeRunnableGuard.h:159
RWRunnableGuard rwtMakeRunnableGuard(DR(*function)(void))
Definition rwtMakeRunnableGuard.h:57

Global Function Templates

The function templates in this section use the following naming conventions for their arguments:

DR Type name of the function return value. For runnable guards the return must be convertible to a bool.
Callee Name of the class of a member function used as a runnable guard.
callee Class instance bound to the member function used as a runnable guard.
function Name of the function, member or otherwise, to be used as a runnable guard.
A1 Type of the first callee argument accepted by the runnable guard function.
AA1 Type name of the first caller argument passed to the runnable guard, at the creation of the runnable guard instance.
a1 Value of the first caller argument passed to a runnable guard instance at its creation.
A2 Type name of the second callee argument accepted by the runnable guard function.
AA2 Type name of the second caller argument passed to the runnable guard, at the creation of the runnable guard instance.
a2 Value of the second caller argument passed to a runnable guard instance at its creation.
A3 Type of the third callee argument accepted by the runnable guard function.
AA3 Type name of the third caller argument passed to the runnable guard, at the creation of the runnable guard instance.
a3 Value of the third caller argument passed to a runnable guard instance at its creation.

Macros (for Use With Member Functions)

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

DR Type name of the function return value. For runnable guards, the return type is a bool.
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.
A3 Type name of the third argument.
a3 Expression that can be converted to an instance of A3.
See also
RWRunnableServer, RWServerPool

Macro Definition Documentation

◆ rwtMakeRunnableGuardG

#define rwtMakeRunnableGuardG ( DR,
function )
Deprecated
As of SourcePro 12.5, use rwBind(function) instead.

Creates an RWRunnableGuard set to call function().

◆ rwtMakeRunnableGuardGA1

#define rwtMakeRunnableGuardGA1 ( DR,
function,
A1,
a1 )
Deprecated
As of SourcePro 12.5, use rwBind(function, a1) instead.

Creates an RWRunnableGuard set to call function(a1).

◆ rwtMakeRunnableGuardGA2

#define rwtMakeRunnableGuardGA2 ( DR,
function,
A1,
a1,
A2,
a2 )
Deprecated
As of SourcePro 12.5, use rwBind(function, a1, a2) instead.

Creates an RWRunnableGuard set to call function(a1,a2).

◆ rwtMakeRunnableGuardGA3

#define rwtMakeRunnableGuardGA3 ( DR,
function,
A1,
a1,
A2,
a2,
A3,
a3 )
Deprecated
As of SourcePro 12.5, use rwBind(function, a1, a2, a3) instead.

Creates an RWRunnableGuard set to call function(a1,a2,a3).

◆ rwtMakeRunnableGuardM

#define rwtMakeRunnableGuardM ( Callee,
callee,
DR,
function )
Deprecated
As of SourcePro 12.5, use rwBind(function, callee) instead.

Creates an RWRunnableGuard set to call callee.function().

◆ rwtMakeRunnableGuardMA1

#define rwtMakeRunnableGuardMA1 ( Callee,
callee,
DR,
function,
A1,
a1 )
Deprecated
As of SourcePro 12.5, use rwBind(function, callee, a1) instead.

Creates an RWRunnableGuard set to call callee.function(a1).

◆ rwtMakeRunnableGuardMA2

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

Creates an RWRunnableGuard set to call callee.function(a1,a2).

◆ rwtMakeRunnableGuardMA3

#define rwtMakeRunnableGuardMA3 ( Callee,
callee,
DR,
function,
A1,
a1,
A2,
a2,
A3,
a3 )
Deprecated
As of SourcePro 12.5, use rwBind(function, callee, a1, a2, a3) instead.

Creates an RWRunnableGuard set to call callee.function(a1,a2,a3).

Function Documentation

◆ rwtMakeRunnableGuard() [1/8]

template<class Callee , class DR , class A1 , class AA1 >
RWRunnableGuard rwtMakeRunnableGuard ( Callee & callee,
DR(Callee::* function )(A1),
AA1 a1 )
Deprecated
As of SourcePro 12.5, use rwBind(function, callee, a1) instead.

Creates an RWRunnableGuard to call callee.function(a1), which returns DR.

◆ rwtMakeRunnableGuard() [2/8]

template<class Callee , class DR , class A1 , class AA1 , class A2 , class AA2 >
RWRunnableGuard rwtMakeRunnableGuard ( Callee & callee,
DR(Callee::* function )(A1, A2),
AA1 a1,
AA2 a2 )
Deprecated
As of SourcePro 12.5, use rwBind(function, callee, a1, a2) instead.

Creates an RWRunnableGuard to call callee.function(a1,a2), which returns DR.

◆ rwtMakeRunnableGuard() [3/8]

template<class Callee , class DR , class A1 , class AA1 , class A2 , class AA2 , class A3 , class AA3 >
RWRunnableGuard rwtMakeRunnableGuard ( Callee & callee,
DR(Callee::* function )(A1, A2, A3),
AA1 a1,
AA2 a2,
AA3 a3 )
Deprecated
As of SourcePro 12.5, use rwBind(function, callee, a1, a2, a3) instead.

Creates an RWRunnableGuard to call callee.function(a1,a2,a3), which returns DR.

◆ rwtMakeRunnableGuard() [4/8]

template<class Callee , class DR >
RWRunnableGuard rwtMakeRunnableGuard ( Callee & callee,
DR(Callee::* function )(void) )
Deprecated
As of SourcePro 12.5, use rwBind(function, callee) instead.

Creates an RWRunnableGuard to call callee.function(), which returns DR.

◆ rwtMakeRunnableGuard() [5/8]

template<class DR , class A1 , class AA1 >
RWRunnableGuard rwtMakeRunnableGuard ( DR(* function )(A1),
AA1 a1 )
Deprecated
As of SourcePro 12.5, use rwBind(function, a1) instead.

Creates an RWRunnableGuard to call function(a1), which returns DR.

◆ rwtMakeRunnableGuard() [6/8]

template<class DR , class A1 , class A2 , class AA1 , class AA2 >
RWRunnableGuard rwtMakeRunnableGuard ( DR(* function )(A1, A2),
AA1 a1,
AA2 a2 )
Deprecated
As of SourcePro 12.5, use rwBind(function, a1, a2) instead.

Creates an RWRunnableGuard to call function(a1,a2), which returns DR.

◆ rwtMakeRunnableGuard() [7/8]

template<class DR , class A1 , class A2 , class A3 , class AA1 , class AA2 , class AA3 >
RWRunnableGuard rwtMakeRunnableGuard ( DR(* function )(A1, A2, A3),
AA1 a1,
AA2 a2,
AA3 a3 )
Deprecated
As of SourcePro 12.5, use rwBind(function, a1, a2, a3) instead.

Creates an RWRunnableGuard to call function(a1,a2,a3), which returns DR.

◆ rwtMakeRunnableGuard() [8/8]

template<class DR >
RWRunnableGuard rwtMakeRunnableGuard ( DR(* function )(void))
Deprecated
As of SourcePro 12.5, use rwBind(function) instead.

Creates an RWRunnableGuard to call function(), which returns DR.

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