Files
Upsilon/apps/graph/evaluate_context.cpp
Émilie Feral 38c3ac0e2b [poincare] make the evaluation of symbol not constant to allow dynamic
evaluation

Change-Id: Iddff962e1617211a4e36704f90090fd808811642
2016-11-04 16:32:05 +01:00

25 lines
481 B
C++

#include "evaluate_context.h"
#include <string.h>
namespace Graph {
EvaluateContext::EvaluateContext(::Context * parentContext) :
m_xValue(Float(0.0f)),
m_context(parentContext)
{
}
void EvaluateContext::setOverridenValueForSymbolX(float f) {
m_xValue = Float(f);
}
const Expression * EvaluateContext::expressionForSymbol(const Symbol * symbol) {
if (symbol->name() == 'x') {
return &m_xValue;
} else {
return m_context->expressionForSymbol(symbol);
}
}
}