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 | |
virtual bool | eval (void) const |
Simply return the cached value for the termination condition (evalValue_). | |
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(). | |
PlannerThreadedTerminationCondition (double period) | |
Construct a termination condition that is evaluated every period seconds. An implementation of computeEval() other than the default needs to be provided. | |
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 | ~PlannerThreadedTerminationCondition (void) |
Protected Member Functions | |
virtual bool | computeEval (void) |
Evaluate the termination condition. By default this is a call to fn_() from the base class. | |
void | periodicEval (void) |
Worker function that runs in a separate thread (calls computeEval()). | |
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. | |
Protected Attributes | |
bool | evalValue_ |
Cached value returned by computeEval(). | |
double | period_ |
Interval of time (seconds) to wait between calls to computeEval(). | |
boost::thread * | thread_ |
Thread for periodicEval(). |
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 124 of file PlannerTerminationCondition.h.
ompl::base::PlannerThreadedTerminationCondition::PlannerThreadedTerminationCondition | ( | double | period | ) |
Construct a termination condition that is evaluated every period seconds. An implementation of computeEval() other than the default needs to be provided.
ompl::base::PlannerThreadedTerminationCondition::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 ompl::base::PlannerThreadedTerminationCondition::~PlannerThreadedTerminationCondition | ( | void | ) | [virtual] |
virtual bool ompl::base::PlannerThreadedTerminationCondition::computeEval | ( | void | ) | [protected, virtual] |
Evaluate the termination condition. By default this is a call to fn_() from the base class.
virtual bool ompl::base::PlannerThreadedTerminationCondition::eval | ( | void | ) | const [virtual] |
Simply return the cached value for the termination condition (evalValue_).
Reimplemented from ompl::base::PlannerTerminationCondition.
void ompl::base::PlannerThreadedTerminationCondition::periodicEval | ( | void | ) | [protected] |
Worker function that runs in a separate thread (calls computeEval()).
void ompl::base::PlannerThreadedTerminationCondition::startEvalThread | ( | void | ) | [protected] |
Start the thread evaluating termination conditions if not already started.
void ompl::base::PlannerThreadedTerminationCondition::stopEvalThread | ( | void | ) | [protected] |
Stop the thread evaluating termination conditions if not already stopped.
virtual void ompl::base::PlannerThreadedTerminationCondition::terminate | ( | bool | flag | ) | [virtual] |
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.
Reimplemented from ompl::base::PlannerTerminationCondition.
bool ompl::base::PlannerThreadedTerminationCondition::evalValue_ [protected] |
Cached value returned by computeEval().
Definition at line 171 of file PlannerTerminationCondition.h.
double ompl::base::PlannerThreadedTerminationCondition::period_ [protected] |
Interval of time (seconds) to wait between calls to computeEval().
Definition at line 174 of file PlannerTerminationCondition.h.
boost::thread* ompl::base::PlannerThreadedTerminationCondition::thread_ [protected] |
Thread for periodicEval().
Definition at line 168 of file PlannerTerminationCondition.h.