All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator
ompl::base::PlannerThreadedTerminationCondition Class Reference

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>

Inheritance diagram for ompl::base::PlannerThreadedTerminationCondition:

List of all members.

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 void terminate (bool flag)
 Notify that the condition for termination should become true, regardless of what eval() returns. Furthermore, if flag is true and the thread evaluating the termination condition is active, the thread is terminated. The tread will be restarted if flag = false is passed.
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()

Detailed Description

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 110 of file PlannerTerminationCondition.h.


The documentation for this class was generated from the following files: