mirror of
https://github.com/UpsilonNumworks/Upsilon.git
synced 2026-03-26 17:20:53 +01:00
[poincare] Add constants to context class
Change-Id: I31f1cdc6ac49062d5cac36c36f8f9650dac9ea61
This commit is contained in:
@@ -15,10 +15,12 @@ class Context {
|
||||
virtual const Expression * expressionForSymbol(const Symbol * symbol);
|
||||
virtual const Expression * scalarExpressionForIndex(int index);
|
||||
void setExpressionForSymbolName(Expression * expression, const Symbol * symbol);
|
||||
static constexpr uint16_t k_maxNumberOfScalarExpressions = 26;
|
||||
static constexpr uint16_t k_maxNumberOfListExpressions = 10;
|
||||
static constexpr uint16_t k_maxNumberOfMatrixExpressions = 10;
|
||||
private:
|
||||
int symbolIndex(const Symbol * symbol) const;
|
||||
static constexpr uint16_t k_maxNumberOfExpressions = 26;
|
||||
Expression * m_expressions[k_maxNumberOfExpressions];
|
||||
Expression * m_expressions[k_maxNumberOfScalarExpressions];
|
||||
static Float * defaultExpression();
|
||||
};
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
|
||||
Context::Context()
|
||||
{
|
||||
for (int i = 0; i < k_maxNumberOfExpressions; i++) {
|
||||
for (int i = 0; i < k_maxNumberOfScalarExpressions; i++) {
|
||||
m_expressions[i] = nullptr;
|
||||
}
|
||||
}
|
||||
@@ -20,7 +20,7 @@ int Context::symbolIndex(const Symbol * symbol) const {
|
||||
|
||||
const Expression * Context::expressionForSymbol(const Symbol * symbol) {
|
||||
int index = symbolIndex(symbol);
|
||||
if (index < 0 || index >= k_maxNumberOfExpressions) {
|
||||
if (index < 0 || index >= k_maxNumberOfScalarExpressions) {
|
||||
return nullptr;
|
||||
}
|
||||
if (m_expressions[index] == nullptr) {
|
||||
@@ -30,7 +30,7 @@ const Expression * Context::expressionForSymbol(const Symbol * symbol) {
|
||||
}
|
||||
|
||||
const Expression * Context::scalarExpressionForIndex(int index) {
|
||||
assert(index < k_maxNumberOfExpressions);
|
||||
assert(index < k_maxNumberOfScalarExpressions);
|
||||
return m_expressions[index];
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user