[apps/graph] Reworked function caching

Instead of being memoized all at once before display, functions values
are now stored at evaluation time. Fixed some quirks with caching
preparation.

Change-Id: I5d212c271c8c41a6dc9074a15c720f0bccf8ac40
This commit is contained in:
Gabriel Ozouf
2020-06-12 12:38:35 +02:00
committed by Émilie Feral
parent 42fcf557b8
commit 1bee23cf4f
8 changed files with 84 additions and 112 deletions

View File

@@ -351,18 +351,6 @@ Poincare::Expression ContinuousFunction::sumBetweenBounds(double start, double e
* the derivative table. */
}
Poincare::Coordinate2D<float> ContinuousFunction::checkForCacheHitAndEvaluate(float t, Poincare::Context * context) const {
Poincare::Coordinate2D<float> res(NAN, NAN);
if (cacheIsFilled()) {
res = cache()->valueForParameter(this, t);
}
if (std::isnan(res.x1()) || std::isnan(res.x2())) {
res = privateEvaluateXYAtParameter(t, context);
//res = Poincare::Coordinate2D<float>(privateEvaluateXYAtParameter(t, context).x1(), 0);
}
return res;
}
Ion::Storage::Record::ErrorStatus ContinuousFunction::setContent(const char * c, Poincare::Context * context) {
clearCache();
return ExpressionModelHandle::setContent(c, context);