Interface of expression calculator.
You can find more information in comments below.
class ICalculator
{
public:
virtual int getErrorCount() = 0; // Return error count
virtual ERROR_INFO getError(const int index) = 0; // Return error info by index
virtual int getProcedureCount() const = 0; // Return assigned procedure count
virtual IProcedure *getProcedure(const int index) = 0; // Return procedure by index
virtual IProcedure *getProcedure(const String &name) = 0; // Return procedure by name
virtual int getVariableCount() const = 0; // Return assigned variable count
virtual CVariable *getVariable(const int index) = 0; // Return variable by index
virtual CVariable *getVariable(const String &name) = 0; // Return variable by name
virtual IEntityCalculator *getEntityCalculator() = 0; // Return assigned or default entity calculator
virtual bool setEntityCalculator(IEntityCalculator *value) = 0; // Set new entity calculator. Old one will be destroyed. If nullptr is passed, default one will be used
virtual bool AddProcedure(IProcedure *proc) = 0; // Add procedure
virtual bool DeleteProcedure(const int index) = 0; // Delete procedure by index
virtual bool DeleteProcedure(IProcedure *proc) = 0; // Delete specified procedure
virtual bool DeleteProcedure(const String &name) = 0; // Delete procedure by name
virtual bool ClearProcedures() = 0; // Delete all procedures
virtual bool AddVariable(CVariable *value) = 0; // Add variable
virtual CVariable *AddVariable(const String &name) = 0; // Create and add variable with specified name
virtual CVariable *AddVariable(const String &name, const String &value) = 0; // Create and add variable with specified name and string value
virtual CVariable *AddVariable(const String &name, const long long value) = 0; // Create and add variable with specified name and integer value
virtual CVariable *AddVariable(const String &name, const double value) = 0; // Create and add variable with specified name and float value
virtual void SetVariable(const String &name, const String &value) = 0; // Create or update variable with specified name to new specified string value
virtual void SetVariable(const String &name, const long long value) = 0; // Create or update variable with specified name to new specified integer value
virtual void SetVariable(const String &name, const double value) = 0; // Create or update variable with specified name to new specified float value
virtual bool DeleteVariable(const int index) = 0; // Delete variable by index
virtual bool DeleteVariable(CVariable *item) = 0; // Delete specified variable
virtual bool DeleteVariable(const String &name) = 0; // Delete variable by name
virtual bool ClearVariables() = 0; // Delete all variables
virtual void ClearErrors() = 0; // Clear previous calculation errors
virtual CVariable *Calculate(CExpression *expression, CVariable *parent) = 0; // Calculate expression
virtual void Release() = 0; // Delete itself
};
Namespace: | nitisa::scripting |
Include: | Nitisa/Modules/Scripting/ICalculator.h |