SourcePro® API Reference Guide

 
Macros | Functions
rwtMakeRunnableGuard Macros and Functions

Module 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 <iostream>
#include <rw/thread/RWRunnableFunction.h>
#include <rw/thread/RWRunnableServer.h>
#include <rw/thread/rwtMakeRunnableFunction.h>
#include <rw/thread/RWRunnableGuard.h>
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.
guard1 = rwtMakeRunnableGuard(yourClass,
&YourClass::yourFunc);
runnableServer.enqueue(doSomething, guard1);
// Construct a guard functor using a macro.
guard2 = rwtMakeRunnableGuardM(YourClass,
yourClass,
bool,
&YourClass::yourFunc);
runnableServer.enqueue(doSomething, guard2);
runnableServer.stop();
runnableServer.join();
return 0;
}

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

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 DR >
RWRunnableGuard rwtMakeRunnableGuard (DR(*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 Callee , class DR >
RWRunnableGuard rwtMakeRunnableGuard (Callee &callee, DR(Callee::*function)(void))
 
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)
 

Macro Definition Documentation

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

Creates an RWRunnableGuard set to call function().

#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).

#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).

#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).

#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().

#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).

#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).

#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

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

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

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

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

template<class DR , class A1 , class A2 , class AA1 , class AA2 >
RWRunnableGuard rwtMakeRunnableGuard ( DR(*)(A1, A2)  function,
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.

template<class DR , class A1 , class A2 , class A3 , class AA1 , class AA2 , class AA3 >
RWRunnableGuard rwtMakeRunnableGuard ( DR(*)(A1, A2, A3)  function,
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.

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

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

template<class Callee , class DR , class A1 , class AA1 >
RWRunnableGuard rwtMakeRunnableGuard ( Callee &  callee,
DR(Callee::*)(A1)  function,
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.

template<class Callee , class DR , class A1 , class AA1 , class A2 , class AA2 >
RWRunnableGuard rwtMakeRunnableGuard ( Callee &  callee,
DR(Callee::*)(A1, A2)  function,
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.

template<class Callee , class DR , class A1 , class AA1 , class A2 , class AA2 , class A3 , class AA3 >
RWRunnableGuard rwtMakeRunnableGuard ( Callee &  callee,
DR(Callee::*)(A1, A2, A3)  function,
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.

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