-
Notifications
You must be signed in to change notification settings - Fork 1
/
ginacmathengine.h
executable file
·54 lines (40 loc) · 1.32 KB
/
ginacmathengine.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
#ifndef GINACMATHENGINE_H
#define GINACMATHENGINE_H
#include "symbolicmathengine.h"
#include "ginacexpr.h"
#include <ginac/ginac.h>
#include <QHash>
typedef SymbolicExpr * (*MathFunction)(QList<SymbolicExpr *>);
class SymbolicMathFunction
{
public:
SymbolicMathFunction(bool undo, qint16 operands, int operandsType, MathFunction func);
bool undo() { return m_undo;}
quint16 nbOperands() { return m_operands; }
int operandsType() { return m_operandsType; }
MathFunction func() { return m_func; }
private:
bool m_undo;
quint16 m_operands;
int m_operandsType;
MathFunction m_func;
};
class GiNacMathEngine : public SymbolicMathEngine
{
public:
GiNacMathEngine();
SymbolicExpr * strToExpr(QString e, bool rationalMode = false);
bool operandValid(QString o);
SymbolicExpr * addSymbol(QString e);
SymbolicExpr * constants(QString e);
static GiNacExpr * getOp(QList<SymbolicExpr *> ops, uint16 idx);
static GiNaC::ex getOp_ex(QList<SymbolicExpr *> ops, uint16 idx);
SymbolicMathFunction *getFunction(QString key);
Features features();
// math functions
static SymbolicExpr * addall(QList<SymbolicExpr *> ops);
static SymbolicExpr * suball(QList<SymbolicExpr *> ops);
private:
QHash<QString, SymbolicMathFunction *> funcMap;
};
#endif // GINACMATHENGINE_H