mirror of
https://github.com/UpsilonNumworks/Upsilon.git
synced 2026-01-18 16:27:34 +01:00
[apps/shared] Functions cache clears on change
Added several triggers to clear the cache when the function's type, range or content is changed. Change-Id: I4f49a90bb6571e335a4a601723d7715b8de1e25e
This commit is contained in:
committed by
Émilie Feral
parent
552dca9494
commit
a9c633a540
@@ -125,6 +125,8 @@ void ContinuousFunction::setPlotType(PlotType newPlotType, Poincare::Preferences
|
||||
|
||||
recordData()->setPlotType(newPlotType);
|
||||
|
||||
cache()->clear();
|
||||
|
||||
// Recompute the layouts
|
||||
m_model.tidy();
|
||||
|
||||
@@ -251,10 +253,12 @@ float ContinuousFunction::tMax() const {
|
||||
|
||||
void ContinuousFunction::setTMin(float tMin) {
|
||||
recordData()->setTMin(tMin);
|
||||
cache()->clear();
|
||||
}
|
||||
|
||||
void ContinuousFunction::setTMax(float tMax) {
|
||||
recordData()->setTMax(tMax);
|
||||
cache()->clear();
|
||||
}
|
||||
|
||||
void * ContinuousFunction::Model::expressionAddress(const Ion::Storage::Record * record) const {
|
||||
@@ -347,6 +351,11 @@ Poincare::Expression ContinuousFunction::sumBetweenBounds(double start, double e
|
||||
* the derivative table. */
|
||||
}
|
||||
|
||||
Ion::Storage::Record::ErrorStatus ContinuousFunction::setContent(const char * c, Poincare::Context * context) {
|
||||
cache()->clear();
|
||||
return ExpressionModelHandle::setContent(c, context);
|
||||
}
|
||||
|
||||
template Coordinate2D<float> ContinuousFunction::templatedApproximateAtParameter<float>(float, Poincare::Context *) const;
|
||||
template Coordinate2D<double> ContinuousFunction::templatedApproximateAtParameter<double>(double, Poincare::Context *) const;
|
||||
|
||||
|
||||
@@ -80,6 +80,7 @@ public:
|
||||
|
||||
// Cache
|
||||
ContinuousFunctionCache * cache() const { return const_cast<ContinuousFunctionCache *>(&m_cache); }
|
||||
Ion::Storage::Record::ErrorStatus setContent(const char * c, Poincare::Context * context) override;
|
||||
private:
|
||||
constexpr static float k_polarParamRangeSearchNumberOfPoints = 100.0f; // This is ad hoc, no special justification
|
||||
typedef Poincare::Coordinate2D<double> (*ComputePointOfInterest)(Poincare::Expression e, char * symbol, double start, double step, double max, Poincare::Context * context);
|
||||
|
||||
@@ -30,7 +30,7 @@ public:
|
||||
* behaviour but it is not true for its child classes (for example, in
|
||||
* Sequence). */
|
||||
virtual void tidy() { model()->tidy(); }
|
||||
Ion::Storage::Record::ErrorStatus setContent(const char * c, Poincare::Context * context) { return editableModel()->setContent(this, c, context, symbol()); }
|
||||
virtual Ion::Storage::Record::ErrorStatus setContent(const char * c, Poincare::Context * context) { return editableModel()->setContent(this, c, context, symbol()); }
|
||||
Ion::Storage::Record::ErrorStatus setExpressionContent(const Poincare::Expression & e) { return editableModel()->setExpressionContent(this, e); }
|
||||
protected:
|
||||
ExpressionModel * editableModel() { return const_cast<ExpressionModel *>(model()); }
|
||||
|
||||
Reference in New Issue
Block a user