mirror of
https://github.com/UpsilonNumworks/Upsilon.git
synced 2026-01-18 16:27:34 +01:00
This allows sequences to be used in functions by calling u(x) Change-Id: I336e84a19bf9b3dd0f2e435d1aaebda3c9e71ec8
30 lines
963 B
C++
30 lines
963 B
C++
#ifndef SEQUENCE_CACHE_CONTEXT_H
|
|
#define SEQUENCE_CACHE_CONTEXT_H
|
|
|
|
#include <poincare/context.h>
|
|
#include <poincare/expression.h>
|
|
#include <poincare/symbol.h>
|
|
#include "sequence_context.h"
|
|
|
|
namespace Shared {
|
|
|
|
template<typename T>
|
|
class CacheContext : public Poincare::ContextWithParent {
|
|
public:
|
|
CacheContext(Poincare::Context * parentContext);
|
|
const Poincare::Expression expressionForSymbolAbstract(const Poincare::SymbolAbstract & symbol, bool clone, float unknownSymbolValue = NAN) override;
|
|
void setValueForSymbol(T value, const Poincare::Symbol & symbol);
|
|
void setNValue(int n) { m_nValue = n; }
|
|
void setSequenceContext(SequenceContext * sequenceContext) { m_sequenceContext = sequenceContext;}
|
|
private:
|
|
int nameIndexForSymbol(const Poincare::Symbol & symbol);
|
|
int rankIndexForSymbol(const Poincare::Symbol & symbol);
|
|
T m_values[MaxNumberOfSequences][MaxRecurrenceDepth];
|
|
int m_nValue;
|
|
SequenceContext * m_sequenceContext;
|
|
};
|
|
|
|
}
|
|
|
|
#endif
|