20.10.2013 - Modified PIObject - virtual debugName() for macro piCoutObj, improved timer measurements and timers on Windows
This commit is contained in:
@@ -32,7 +32,8 @@ namespace PIEvaluatorTypes {
|
||||
enum eType {etNumber, etOperator, etVariable, etFunction};
|
||||
enum Operation {oNone, oAdd, oSubtract, oMultiply, oDivide, oResidue, oPower,
|
||||
oEqual, oNotEqual, oGreater, oSmaller, oGreaterEqual, oSmallerEqual,
|
||||
oAnd, oOr, oFunction};
|
||||
oAnd, oOr, oFunction
|
||||
};
|
||||
enum BaseFunctions {bfUnknown, bfSin, bfCos, bfTg, bfCtg,
|
||||
bfArcsin, bfArccos, bfArctg, bfArcctg,
|
||||
bfExp, bfRandom, bfSh, bfCh, bfTh, bfCth,
|
||||
@@ -40,7 +41,9 @@ namespace PIEvaluatorTypes {
|
||||
bfLn, bfLg, bfLog, bfSign,
|
||||
bfIm, bfRe, bfArg, bfLen, bfConj,
|
||||
bfRad, bfDeg, bfJ0, bfJ1, bfJN,
|
||||
bfY0, bfY1, bfYN};
|
||||
bfY0, bfY1, bfYN, bfMin, bfMax,
|
||||
bfClamp, bfStep, bfMix
|
||||
};
|
||||
|
||||
struct Instruction {
|
||||
Instruction() {;}
|
||||
@@ -49,25 +52,29 @@ namespace PIEvaluatorTypes {
|
||||
Operation operation;
|
||||
PIVector<int> operators;
|
||||
int out;
|
||||
int function;};
|
||||
int function;
|
||||
};
|
||||
struct Element {
|
||||
Element() {;}
|
||||
Element(eType new_type, int new_num, int new_var_num = -1) {set(new_type, new_num, new_var_num);}
|
||||
void set(eType new_type, int new_num, int new_var_num = -1) {type = new_type; num = new_num; var_num = new_var_num;}
|
||||
eType type;
|
||||
int num;
|
||||
int var_num;};
|
||||
int var_num;
|
||||
};
|
||||
struct Function {
|
||||
Function() {arguments = 0; type = bfUnknown;}
|
||||
Function(const PIString & name, int args, BaseFunctions ftype) {identifier = name; arguments = args; type = ftype;}
|
||||
PIString identifier;
|
||||
BaseFunctions type;
|
||||
int arguments;};
|
||||
int arguments;
|
||||
};
|
||||
struct Variable {
|
||||
Variable() {value = 0.;}
|
||||
Variable(const PIString & var_name, complexd val) {name = var_name; value = val;}
|
||||
PIString name;
|
||||
complexd value;};
|
||||
complexd value;
|
||||
};
|
||||
};
|
||||
/*
|
||||
≠ :
|
||||
@@ -115,10 +122,11 @@ private:
|
||||
class PIP_EXPORT PIEvaluator
|
||||
{
|
||||
public:
|
||||
PIEvaluator() {;}
|
||||
PIEvaluator() {correct = false;}
|
||||
~PIEvaluator() {;}
|
||||
|
||||
bool check(const PIString & string);
|
||||
bool isCorrect() const {return correct;}
|
||||
int setVariable(const PIString & name, complexd value = 0.) {if (content.findVariable(name) < 0) content.addVariable(name, value); else content.setVariableValue(name, value); return content.findVariable(name);}
|
||||
void setVariable(int index, complexd value = 0.) {if (index >= 0 && index < content.variablesCount()) content.setVariableValue(index, value);}
|
||||
void setCustomVariableValue(int index, complexd value = 0.) {content.variables[index + content.cv_count].value = value;}
|
||||
@@ -126,10 +134,10 @@ public:
|
||||
void removeVariable(const PIString & name) {content.removeVariable(name);}
|
||||
void clearCustomVariables() {content.clearCustomVariables();}
|
||||
int variableIndex(const PIString & name) const {return content.findVariable(name);}
|
||||
const PIStringList & unknownVariables() {return unknownVars;}
|
||||
const PIString & expression() {return currentString;}
|
||||
const PIString & error() {return lastError;}
|
||||
const complexd & lastResult() {return out;}
|
||||
const PIStringList & unknownVariables() const {return unknownVars;}
|
||||
const PIString & expression() const {return currentString;}
|
||||
const PIString & error() const {return lastError;}
|
||||
const complexd & lastResult() const {return out;}
|
||||
|
||||
PIEvaluatorContent content;
|
||||
|
||||
@@ -163,6 +171,7 @@ private:
|
||||
PIStringList unknownVars;
|
||||
PIString currentString, lastError;
|
||||
complexd out;
|
||||
bool correct;
|
||||
};
|
||||
|
||||
inline bool operator ==(PIEvaluatorTypes::Element e1, PIEvaluatorTypes::Element e2) {return (e1.type == e2.type && e1.num == e2.num);}
|
||||
|
||||
Reference in New Issue
Block a user