Termination condition with lazy evaluation. This is just as a regular termination condition, except the condition is actually evaluated by computeEval() and the return value is stored in evalValue_. Every time eval() is called, evalValue_ is returned instead of actually evaluating the termination condition. Furthermore, the termination condition is evaluated every period_ seconds in a separate thread. The thread automatically starts when the condition is constructed and it terminates when the condition becomes true. More...
#include <PlannerTerminationCondition.h>

Public Member Functions | |
| PlannerThreadedTerminationCondition (const PlannerTerminationConditionFn &fn, double period) | |
| Construct a termination condition that is evaluated every period seconds. The evaluation of the condition (the call to computeEval()) consists of calling fn(). | |
| virtual bool | eval (void) const |
| Simply return the cached value for the termination condition (evalValue_) | |
Protected Member Functions | |
| bool | computeEval (void) |
| Evaluate the termination condition. By default this is a call to fn_() from the base class. | |
| void | startEvalThread (void) |
| Start the thread evaluating termination conditions if not already started. | |
| void | stopEvalThread (void) |
| Stop the thread evaluating termination conditions if not already stopped. | |
| void | periodicEval (void) |
| Worker function that runs in a separate thread (calls computeEval()) | |
Protected Attributes | |
| boost::thread * | thread_ |
| Thread for periodicEval() | |
| bool | evalValue_ |
| Cached value returned by computeEval() | |
| double | period_ |
| Interval of time (seconds) to wait between calls to computeEval() | |
Termination condition with lazy evaluation. This is just as a regular termination condition, except the condition is actually evaluated by computeEval() and the return value is stored in evalValue_. Every time eval() is called, evalValue_ is returned instead of actually evaluating the termination condition. Furthermore, the termination condition is evaluated every period_ seconds in a separate thread. The thread automatically starts when the condition is constructed and it terminates when the condition becomes true.
Definition at line 111 of file PlannerTerminationCondition.h.