more ai generated doc with human review
This commit is contained in:
@@ -1,9 +1,13 @@
|
||||
/*! \file pievaluator.h
|
||||
* \ingroup Math
|
||||
* \~\brief
|
||||
* \~english Mathematic expressions calculator
|
||||
* \~russian Вычислитель математических выражений
|
||||
*/
|
||||
//! \addtogroup Math
|
||||
//! \{
|
||||
//! \file pievaluator.h
|
||||
//! \brief
|
||||
//! \~english Mathematic expressions calculator
|
||||
//! \~russian Вычислитель математических выражений
|
||||
//! \details
|
||||
//! \~english Evaluator for parsing and calculating mathematical expressions
|
||||
//! \~russian Вычислитель для разбора и вычисления математических выражений
|
||||
//! \}
|
||||
/*
|
||||
PIP - Platform Independent Primitives
|
||||
Evaluator designed for stream calculations
|
||||
@@ -180,36 +184,72 @@ struct PIP_EXPORT Variable {
|
||||
⋁ |
|
||||
*/
|
||||
|
||||
//! Content container for variables and functions
|
||||
//! \~\english Container for variables and functions of the evaluator
|
||||
//! \~russian Контейнер для переменных и функций вычислителя
|
||||
class PIP_EXPORT PIEvaluatorContent {
|
||||
friend class PIEvaluator;
|
||||
BINARY_STREAM_FRIEND(PIEvaluatorContent);
|
||||
|
||||
public:
|
||||
//! Constructs an empty evaluator content
|
||||
PIEvaluatorContent();
|
||||
~PIEvaluatorContent() { ; }
|
||||
|
||||
//! Add function with specified name and argument count
|
||||
//! \~english Add function with name and default 1 argument
|
||||
//! \~russian Добавить функцию с указанным именем и количеством аргументов (по умолчанию 1)
|
||||
void addFunction(const PIString & name, int args = 1);
|
||||
//! Add variable with specified name and value
|
||||
//! \~english Add variable with name and optional value, returns variable index
|
||||
//! \~russian Добавить переменную с указанным именем и значением, возвращает индекс переменной
|
||||
int addVariable(const PIString & name, const complexd & val = 0.);
|
||||
//! Add custom function with handler
|
||||
//! \~english Add custom function with name, argument count and handler function
|
||||
//! \~russian Добавить пользовательскую функцию с обработчиком
|
||||
void addCustomFunction(const PIString & name, int args_count, PIEvaluatorTypes::FuncHanlder func);
|
||||
//! Get number of functions
|
||||
int functionsCount() const { return functions.size(); }
|
||||
//! Get number of variables
|
||||
int variablesCount() const { return variables.size(); }
|
||||
//! Get number of custom variables
|
||||
int customVariablesCount() const;
|
||||
//! Find function index by name
|
||||
int findFunction(const PIString & name) const;
|
||||
//! Find variable index by name
|
||||
int findVariable(const PIString & var_name) const;
|
||||
//! Get function by index
|
||||
PIEvaluatorTypes::Function function(int index);
|
||||
//! Get variable by index
|
||||
PIEvaluatorTypes::Variable variable(int index);
|
||||
//! Get function by name
|
||||
PIEvaluatorTypes::Function function(const PIString & name) { return function(findFunction(name)); }
|
||||
//! Get variable by name
|
||||
PIEvaluatorTypes::Variable variable(const PIString & name) { return variable(findVariable(name)); }
|
||||
//! Get custom variable by index
|
||||
PIEvaluatorTypes::Variable customVariable(int index);
|
||||
//! Set variable value by index
|
||||
//! \~english Set variable value by index, returns true on success
|
||||
//! \~russian Установить значение переменной по индексу, возвращает true при успехе
|
||||
bool setVariableValue(int index, complexd new_value);
|
||||
//! Set variable value by name
|
||||
//! \~english Set variable value by name, returns true on success
|
||||
//! \~russian Установить значение переменной по имени, возвращает true при успехе
|
||||
bool setVariableValue(const PIString & var_name, const complexd & new_value) {
|
||||
return setVariableValue(findVariable(var_name), new_value);
|
||||
}
|
||||
//! Set variable name by index
|
||||
bool setVariableName(int index, const PIString & new_name);
|
||||
//! Set variable name by name
|
||||
bool setVariableName(const PIString & var_name, const PIString & new_name) { return setVariableName(findVariable(var_name), new_name); }
|
||||
//! Clear all custom variables
|
||||
void clearCustomVariables();
|
||||
//! Get base function type by name
|
||||
PIEvaluatorTypes::BaseFunctions getBaseFunction(const PIString & name);
|
||||
|
||||
//! Dump content to console for debugging
|
||||
//! \~english Print all functions and variables to console
|
||||
//! \~russian Вывести все функции и переменные в консоль
|
||||
void dump();
|
||||
|
||||
private:
|
||||
@@ -219,6 +259,9 @@ private:
|
||||
};
|
||||
|
||||
|
||||
//! Main evaluator class for parsing and calculating mathematical expressions
|
||||
//! \~\english Main class for parsing and evaluating mathematical expressions
|
||||
//! \~russian Главный класс для разбора и вычисления математических выражений
|
||||
class PIP_EXPORT PIEvaluator {
|
||||
public:
|
||||
//! Constructs an empty evaluator
|
||||
|
||||
Reference in New Issue
Block a user