Numworks Epsilon  1.4.1
Graphing Calculator Operating System
global_context.h
Go to the documentation of this file.
1 #ifndef POINCARE_GLOBAL_CONTEXT_H
2 #define POINCARE_GLOBAL_CONTEXT_H
3 
4 #include <poincare/context.h>
5 #include <poincare/matrix.h>
6 #include <poincare/complex.h>
7 
8 namespace Poincare {
9 
10 class Integer;
11 
12 /* The global context only stores symbols A-Z, L1-L9 and M1-M9 */
13 
14 class GlobalContext : public Context {
15 public:
16  GlobalContext();
18  GlobalContext(const GlobalContext& other) = delete;
19  GlobalContext(GlobalContext&& other) = delete;
20  GlobalContext& operator=(const GlobalContext& other) = delete;
21  GlobalContext& operator=(GlobalContext&& other) = delete;
22  /* The expression recorded in global context is already a expression.
23  * Otherwise, we would need the context and the angle unit to evaluate it */
24  const Expression * expressionForSymbol(const Symbol * symbol) override;
26  void setExpressionForSymbolName(const Expression * expression, const Symbol * symbol, Context & context) override;
28  static constexpr uint16_t k_maxNumberOfListExpressions = 10;
30 private:
31  static Complex<double> * defaultExpression();
32  int symbolIndex(const Symbol * symbol) const;
34  Matrix * m_matrixExpressions[k_maxNumberOfMatrixExpressions];
35  /* Matrix layout memoization */
37  Complex<double> m_pi;
38  Complex<double> m_e;
39  Complex<double> m_i;
40 };
41 
42 }
43 
44 #endif
ExpressionLayout * expressionLayoutForSymbol(const Symbol *symbol)
const Expression * expressionForSymbol(const Symbol *symbol) override
static constexpr uint16_t k_maxNumberOfMatrixExpressions
GlobalContext & operator=(const GlobalContext &other)=delete
unsigned short uint16_t
Definition: stdint.h:5
void setExpressionForSymbolName(const Expression *expression, const Symbol *symbol, Context &context) override
static constexpr uint16_t k_maxNumberOfListExpressions
static constexpr uint16_t k_maxNumberOfScalarExpressions