AURobotServers
4
|
#include <uvarcalc.h>
Public Member Functions | |
double | evaluateD (const char *line, const char *start, const char **end, bool *evaluated, bool syntaxCheck) |
Get value for the variable or function call with this name Variables and functions in the local scope has first priority, then gradually one scope at a time until root scope. After that the math scope is tested. true if found. More... | |
bool | evaluateParametersD (const char *sourceLine, const char **paramStart, double *paramValues, int *paramValuesCnt, char **paramStr, char *paramOrder, int maxParamCount, int maxParamStrCount, int maxParamStrLength) |
bool | evaluateParametersV (const char *sourceLine, const char **paramStart, char *paramOrder, UVariable *params[], int *paramsCnt, int maxParamsCnt) |
bool | evaluateToStringD (const char *sourceLine, const char *paramStart, const char **nextChar, char *dest, int destLength) |
bool | evaluateToStringV (const char *sourceLine, const char *paramStart, const char **nextChar, char *dest, int destLength) |
double | evaluateUnaryValD (const char *line, const char *start, const char **end, bool *evaluated, bool syntaxCheck) |
Evaluate an expression. More... | |
bool | evaluateUnaryValV (const char *line, const char *start, const char **end, UVariable *value, bool syntaxCheck) |
bool | evaluateV (const char *line, const char *start, const char **end, UVariable *value, bool syntaxCheck) |
Evaluate an expression. More... | |
char * | getErrorTxt () |
int | getErrorTxtMaxCnt () |
bool | getIdentifier (const char *id, int idCnt, const char *allowed, const char **oChar) |
bool | getValueAnyD (UVarPool *scope, const char *name, double *value, const char **params) |
Get value for the variable or function call with this name Variables and functions in the local scope has first priority, then gradually one scope at a time until root scope. After that the math scope is tested. true if found. More... | |
bool | getValueAnyV (UVarPool *scope, const char *name, UVariable *value, const char **params) |
Get value for the variable or function call with this name Variables and functions in the local scope has first priority, then gradually one scope at a time until root scope. After that the math scope is tested. true if found. More... | |
bool | getVariableAny (UVarPool *scope, const char *name, UVariable *value) |
Get the variable with this name in the specified scope (incl. math) Variables in the local scope has first priority, then gradually one scope at a time until root scope. After that the math scope is tested. true if found. More... | |
bool | getVariableRefAny (UVarPool *scope, const char *name, UVariable **found, int *nameIndex) |
Get reference to variable with this name in the specified scope (incl. math) Variables in the local scope has first priority, then gradually one scope at a time until root scope. After that the math scope is tested. true if found. More... | |
bool | isDefined (UVarPool *scope, const char *varName) |
Is this variable defined in the scope. The test is for variables and structures, and in the provided scope as well as any parent scope. further the math scope is tested too. More... | |
bool | isRemark (const char *string) |
bool | setResource (UResBase *resource, bool remove) |
Called by server core when new resources are available. More... | |
UVarCalc () | |
virtual | ~UVarCalc () |
Public Member Functions inherited from UVarPool | |
int | addMethod (UVarMethodImplement *implementor, const char *formalName, const char *paramTypes, const char *comment) |
int | addMethodV (UVarMethodImplement *implementor, const char *formalName, const char *paramTypes, const char *comment) |
int | addStruct (const char *name, UVarPool *varStruct) |
int | addStructLink (const char *name, UVarPool *toVarStruct) |
Add a link to another place in the var tree but do not change anything in the linked structure. More... | |
UVarPool * | addStructLocal (const char *name, const char *note, bool copy) |
UVariable * | addVar (const char *name, const double initialValue, const char *type, const char *comment) |
UVariable * | addVar (const char *name, const double initialValue, UVariable::varType type, const char *comment, const char *attValue=NULL) |
UVariable * | addVar (const char *name, const UVariable *source, const char *comment) |
UVariable * | addVar (const char *name, const char *comment) |
UVariable * | addVarA (const char *name, const char *attValue, const char *type, const char *comment) |
bool | callGlobal (const char *name, const char *paramOrder, char **strings, const double *doubles, double *value, UDataBase **returnStruct, int *returnStructCnt) |
Call a method in the root var pool. It may be in this structure or in any sub-structure that the 'name' indicate. More... | |
bool | callGlobalV (const char *name, const char *paramOrder, UVariable **params, UDataBase **returnStruct, int *returnStructCnt) |
Call a method from the root var pool scope It may be in the structure direct (no '.') or in any sub-structure that the 'name.subname' indicate. More... | |
bool | callLocal (const char *name, const char *paramOrder, char **strings, const double *doubles, double *value, UDataBase **returnStruct, int *returnStructCnt) |
Call a method in this var pool. It may be in this structure or in any sub-structure that the 'name' indicate. More... | |
bool | callLocalV (const char *name, const char *paramOrder, UVariable *params[], UDataBase **returnStruct, int *returnStructCnt) |
Call a method in this var pool (using UVariable parameters). It may be in this structure or in any sub-structure that the 'name' indicate. More... | |
bool | callScope (const char *name, const char *paramOrder, char **strings, const double *doubles, double *value, UDataBase **returnStruct, int *returnStructCnt) |
Call a method in this scope, i.e. try if it fits a call in any of the parent var pools. It may be in the structure direct (no '.') or in any sub-structure that the 'name.subname' indicate. More... | |
bool | callScopeV (const char *name, const char *paramOrder, UVariable **params, UDataBase **returnStruct, int *returnStructCnt) |
Call a method in this scope - using UVariable parameters, i.e. try if it fits a call in any of the parent var pools. It may be in the structure direct (no '.') or in any sub-structure that the 'name.subname' indicate. More... | |
bool | createVarSpace (const int varCnt, const int structCnt, const int methCnt, const char *note, bool copy) |
void | deleteAll () |
void | deleteMethod (const char *name, const char *paramStr) |
void | deleteMethods (UVarMethodImplement *owner) |
void | deleteStruct (const char *name) |
const char * | getDescription () |
const char * | getFullPreName (char *name, const int MNL) |
const char * | getFullPreName () |
bool | getGlobalString (const char *name, const char **value) |
bool | getGlobalValue (const char *name, double *value) |
bool | getGlobalValue (const char *name, bool *value) |
bool | getGlobalValue (const char *name, UTime *value) |
UVariable * | getGlobalVariable (const char *name, int *element=NULL) |
get pointer to variable object NB! the returned pointer may be ilegal if module that owns the variable is unloaded so it must be used only while executing one command in main server core thread, if needed in a thread - like the sequencer, then get the value only - getValue(). More... | |
UVarMethod * | getLocalMethod (const char *name, const char *paramList) |
UVarPool * | getLocalMethod (const char *name, const char *paramList, UVarMethod **method) |
UVarMethod * | getLocalMethod (const int index) |
int | getLocalMethodIdx (const char *name, const char *paramList) |
Get index of this method in this var pool. More... | |
double | getLocalValue (int idx, int element=0) |
bool | getLocalValue (const char *name, double *value) |
bool | getLocalValue (const char *name, bool *value) |
bool | getLocalValue (const char *name, UTime *value) |
UPosition | getLocalValue3D (int idx) |
UPosRot | getLocalValue6D (int idx) |
bool | getLocalValueBool (int idx) |
int | getLocalValueInt (int idx) |
UPose | getLocalValuePose (int idx) |
URotation | getLocalValueRot (int idx) |
UTime | getLocalValueTime (int idx) |
UVariable * | getLocalVar (int index) |
UVariable * | getLocalVariable (const char *name, int *element) |
get pointer to variable object in this variable tree More... | |
int | getLocalVarIndex (const char *name, int *element) |
ULogFile * | getLogVar () |
ULock * | getLogVarLock () |
int | getMethodCnt () |
int | getMethodMax () |
UVarPool * | getParentVarPool () |
UVarPool * | getParentVarPoolScope () |
const char * | getPreName () |
UVarPool * | getRootVarPool () |
bool | getScopeValue (const char *name, double *value) |
UVarPool * | getStruct (const char *name) |
UVarPool * | getStruct (const int idx) |
int | getStructCnt () |
UVarPool * | getStructDeep (const char *fullName, char *varName, const int varNameCnt) |
UVarPool * | getStructDeep (const char *fullName, const bool mayAdd, char *varName, const int varNameCnt) |
int | getStructIdx (const char *name) |
int | getStructMax () |
const char * | getVarDescription (int idx) |
int | getVarMax () |
char * | getVarName (int index) |
UVariable ** | getVars () |
int | getVarsCnt () |
bool | isLogfileOpen () |
bool | isVarPoolVerbose () |
void | listVars (const char *preStr, char *buff, const int buffCnt, bool andStructs) |
void | setDescription (const char *note, bool copy) |
bool | setGlobalVar (const char *name, const double value, bool mayAdd) |
Assigns a value to a variable. The variable may be a part of a structure. More... | |
bool | setLocalVar (const int index, const double value, const int element) |
bool | setLocalVar (const int index, UVariable *value) |
bool | setLocalVar (const char *name, const double value, bool mayAdd, UVariable::varType vartyp, const char *attValue=NULL) |
Assigns a value to a variable. The variable may be a part of a structure. More... | |
bool | setLocalVar (const char *name, const char *value, bool mayAdd, const char *vartyp, UTime *updTime=NULL, bool *added=NULL) |
Assigns a value to a variable. The variable may be a part of a structure. More... | |
bool | setLocalVar3D (int idx, UPosition *value) |
bool | setLocalVar6D (int idx, UPosRot *value) |
bool | setLocalVarAdd (const int index, const double value, const int element) |
bool | setLocalVarPose (int idx, UPose *value) |
bool | setLocalVarRot (int idx, URotation *value) |
void | setLogfile (ULogFile *fileHandle, ULock *fileLock) |
void | setParentVarPool (UVarPool *parent) |
void | setParentVarPoolScope (UVarPool *parent) |
bool | setPreName (const char *name) |
bool | setScopeVar (const char *name, const double value, bool mayAdd) |
bool | setScopeVar (const char *name, const UVariable *source, bool mayAdd) |
void | setVerbose (bool value) |
UVarPool () | |
virtual | ~UVarPool () |
Public Member Functions inherited from ULock | |
bool | lock () |
void | lockInit () |
void | post () |
bool | tryLock () |
bool | tryWait () |
ULock () | |
void | unlock () |
bool | wait () |
~ULock () | |
Public Member Functions inherited from UServerPush | |
int | addPushCommand (UServerInMsg *msg) |
virtual void | callGotNewDataWithObject () |
bool | doPushCall (UServerPushElement *pe, const char *value) |
void | flushClientCmds (int clientIdx) |
UServerPushImplement * | getImplementor () |
int | getPushCmdCnt (int *cmdCnt, int *callCnt) |
UServerPushQueue * | getPushQueue () |
bool | gotCmdExe () |
void | gotNewData (void *pData) |
bool | isUpdated (int lastCnt, int *newCnt) |
bool | needNewData () |
void | print (const char *preString) |
void | print (const char *preString, char *buff, int buffCnt) |
void | servicePendingPushCmds () |
void | setCmdExe (UServerPushImplement *executor) |
void | setImplementor (UServerPushImplement *executor) |
bool | setResource (UResBase *resource, bool remove) |
bool | setUpdated (const char *value) |
Add watch object if needed. An image or other object is updated. set object as updated, with an extra qualifier, that may be used as a parameter in a push call. this push list is then added to the to the push list examined by the server thread. when server thread reach this push list it will call to get a possible associated data structure by a call to needNewData() whish is expected to call gotNewData(void * data_structure) - but now in the server thread. More... | |
UServerPush () | |
virtual | ~UServerPush () |
Protected Member Functions | |
virtual bool | getLocalScopeVaiable (const char *name, double *value) |
Protected Member Functions inherited from UVarPool | |
bool | createFunctionStack (const int maxCount) |
bool | createVarPoolStack (const int maxCount) |
bool | createVarStack (const int maxCount) |
virtual bool | evaluateSystemFunction (const char *name, const double pars[], int parsCnt, double *value, bool syntaxCheck) |
Protected Attributes | |
char | errorTxt [MAX_ERROR_SIZE] |
Protected Attributes inherited from UVarPool | |
const char * | description |
ULogFile * | logVar |
ULock * | logVarLock |
UVarPool ** | varPools |
bool * | varPoolsLocal |
bool | verbose |
Class to act as a calculator
UVarCalc::UVarCalc | ( | ) |
Constructor
|
virtual |
Destructor
double UVarCalc::evaluateD | ( | const char * | line, |
const char * | start, | ||
const char ** | end, | ||
bool * | evaluated, | ||
bool | syntaxCheck | ||
) |
Get value for the variable or function call with this name Variables and functions in the local scope has first priority, then gradually one scope at a time until root scope. After that the math scope is tested. true if found.
scope | the scope to be searched for value (normally just from 'getVarPool()') |
value | the found (double) value is returned here (if not NULL). |
params | at this position are the parameters for the function, if parameters are used (and can be evaluated) then the character position are modified to just passed the end bracket for the parameter. Evaluate an expression |
line | is the source line |
start | is where the expression starts in the line |
next | points to the first unused character after evaluation |
evaluated | returns false if string fails to evaluate 'evaluated' (if not NULL) |
syntaxCheck | when true the evaluation is evaluated partially, as far as to the point where values or actions are initiated |
References UVarCalcOper::evaluateD(), UVarCalcOper::evaluateOperator(), UVarCalcOper::getValue(), UVarCalcOper::insertOperator(), MAX_ERROR_SIZE, UVarCalcOper::parent, UVarCalcOper::right, and UVarCalcOper::setValue().
Referenced by UKeepItem::monitorTest().
bool UVarCalc::evaluateParametersD | ( | const char * | sourceLine, |
const char ** | paramStart, | ||
double * | paramValues, | ||
int * | paramValuesCnt, | ||
char ** | paramStr, | ||
char * | paramOrder, | ||
int | maxParamCount, | ||
int | maxParamStrCount, | ||
int | maxParamStrLength | ||
) |
evaluate a single variable
line | is full line that is evaluated upon. |
start | is where to start (on this line). |
evaluated | is set true, if a value is found. |
end | is set to first unused character. |
syntaxCheck | is passed on to any expression of functionCall evaluation. |
source | line is used when reporting syntax error only |
paramStart | is a pointer into the place in 'line' where the parameter analysis should start. |
paramValues | is an array of doubles where the double sized parameters are returned, the size is in maxParamCount |
paramValuesCnt | is a pointer to an interger where the found number of double parameters are returned. |
paramStr | is a pointer to an array of string pointers. This is where the string parameters are returned. The number of strings available is in maxParamStrCount and the length of each string is in maxParamStrLength |
paramOrder | is a string where the sequence of parameters are returned, e.g. "dsd" means the first parameter is a double, returned in paramValue[0], the next is a string returned in paramStr[0] and the third parameter is a double returned in paramValue[1]. |
maxParamCount | is the size of the paramOrder string AND the size of the paramValues array |
maxParamStrCount | max number of string parameters allowed |
maxParamStrLength | is the max length of evaluated string parameters (size of string buffer) true if not syntax error were found. |
References UVarCalcOper::evaluateD(), and MAX_ERROR_SIZE.
bool UVarCalc::evaluateParametersV | ( | const char * | sourceLine, |
const char ** | paramStart, | ||
char * | paramOrder, | ||
UVariable * | params[], | ||
int * | paramsCnt, | ||
int | maxParamsCnt | ||
) |
Evaluate a number [0..maxParamCount] of parameters – for a function call. The number of found parameters gets returned in length of 'paramStr', and the values are present in 'paramValues' and 'paramStr'. Eg: sourceLine: "phi = 23.7 + atan2(y * sin(h), (x - 0.1) * cos(h))", and paramStart: "(y * sin(h), (x - 0.1) * cos(h))" Return will be paramValues = 2, paramValue[0] and [1] will be assigned values, 'paramStart' will point at first character after parameter list - just after the ')' char
source | line is used when reporting syntax error only |
paramStart | is a pointer into the place in 'line' where the parameter analysis should start. |
paramOrder | is a string where the sequence of parameters are returned, e.g. "dsd" means the first parameter is a double, the next is a string and the third parameter is a double. |
params | is a pointer to an array of variables. The number of variable pointers available is in maxParamsCount. Assumed to be NULL pointers, an caller must delete variables created. |
paramsCnt | is a pointer to an interger where the found number of parameters are returned. |
maxParamsCount | max number of string parameters allowed true if not syntax error were found. |
References UVarCalcOper::evaluateV(), MAX_ERROR_SIZE, and UVariable::setValues().
Referenced by UMisControl::execute(), UMisRuleState::initCall(), and UMisRuleState::runRuleCommands().
bool UVarCalc::evaluateToStringD | ( | const char * | sourceLine, |
const char * | paramStart, | ||
const char ** | nextChar, | ||
char * | dest, | ||
int | destLength | ||
) |
Evaluate a string of mixed unknown values and values to evaluate to a new evaluated string, that can be send to a subsystem - e.g. a SMRCL command. Uses evaluateD(...) to evaluate non-strings. If part of the command is in quotes ("), then it is not evaluated. e.g. 'turnr 1.2 ' calcH -0.1 ' "rad" @v' speed ":($odoth >" calcH ")" and speed=0.3 and calcH=0.5, then it is evaluated to: turnr 1.2 0.4 "rad" 0.3 :($odoth > 0.5)
paramStart | the start position (in line) where to start the string extraction |
nextChar | returns the first position after the string, e.g. a ',' or a ')' |
dest | the destination string |
destLength | is the length of the string buffer true if evaluated and there is space in 'dest' string. |
References UVarCalcOper::evaluateD(), MAX_ERROR_SIZE, and UVarCalcOper::value.
bool UVarCalc::evaluateToStringV | ( | const char * | sourceLine, |
const char * | paramStart, | ||
const char ** | nextChar, | ||
char * | dest, | ||
int | destLength | ||
) |
Evaluate a string of mixed unknown values and values to evaluate to a new evaluated string, that can be send to a subsystem - e.g. a SMRCL command. Uses evaluateV(...) to evaluate non-strings. If part of the command is in quotes ("), then it is not evaluated. e.g. 'turnr 1.2 ' calcH -0.1 ' "rad" @v' speed ":($odoth >" calcH ")" and speed=0.3 and calcH=0.5, then it is evaluated to: turnr 1.2 0.4 "rad" 0.3 :($odoth > 0.5)
paramStart | the start position (in line) where to start the string extraction |
nextChar | returns the first position after the string, e.g. a ',' or a ')' |
dest | the destination string |
destLength | is the length of the string buffer true if evaluated and there is space in 'dest' string. |
References UVarCalcOper::evaluateV(), UVariable::getValuesAsString(), MAX_ERROR_SIZE, and UVarCalcOper::value.
Referenced by UMisRuleState::runEnable().
double UVarCalc::evaluateUnaryValD | ( | const char * | line, |
const char * | start, | ||
const char ** | end, | ||
bool * | evaluated, | ||
bool | syntaxCheck | ||
) |
Evaluate an expression.
line | is the source line |
start | is where the expression starts in the line |
next | points to the first unused character after evaluation |
evaluated | returns false if string fails to evaluate 'evaluated' (if not NULL) |
syntaxCheck | when true the evaluation is evaluated partially, as far as to the point where values or actions are initiated |
line | is the source line |
start | is where the expression starts in the line |
next | points to the first unused character after evaluation |
evaluated | returns false if string fails to evaluate 'evaluated' (if not NULL) |
syntaxCheck | when true the evaluation is evaluated partially, as far as to the point where values or actions are initiated Evaluate a single value, that may have a unary operator in front of the value. The syntax may be: ['not' | '-'] (symbol | constant | '(' expression ')' | functionCall ). Returns the value found, or 0 on error. |
line | is full line that is evaluated upon. |
start | is where to start (on this line). |
evaluated | is set true, if a value is found. |
end | is set to first unused character. |
syntaxCheck | is passed on to any expression of functionCall evaluation. |
References UVarCalcOper::evaluateD(), MAX_ERROR_SIZE, MAX_VARIABLE_NAME_SIZE, and roundi().
bool UVarCalc::evaluateUnaryValV | ( | const char * | line, |
const char * | start, | ||
const char ** | end, | ||
UVariable * | value, | ||
bool | syntaxCheck | ||
) |
Evaluate a single value, that may have a unary operator in front of the value. The syntax may be: ['not' | '-'] (symbol | constant | '(' expression ')' | functionCall ). Returns the value found, or 0 on error.
line | is full line that is evaluated upon. |
start | is where to start (on this line). |
end | is set to first unused character. |
value | is the value found (if not NULL). |
syntaxCheck | is passed on to any expression of functionCall evaluation. |
References UVarCalcOper::evaluateV(), UVariable::getValued(), UVariable::isString(), MAX_ERROR_SIZE, MAX_VARIABLE_NAME_SIZE, UVariable::negate(), roundi(), UVariable::setNot(), UVariable::setTypeChar(), UVariable::setValued(), UVariable::setValues(), and UVarCalcOper::value.
bool UVarCalc::evaluateV | ( | const char * | line, |
const char * | start, | ||
const char ** | end, | ||
UVariable * | value, | ||
bool | syntaxCheck | ||
) |
Evaluate an expression.
line | is the source line |
start | is where the expression starts in the line |
next | points to the first unused character after evaluation |
value | returns the resulting value here (if not NULL) |
syntaxCheck | when true the evaluation is evaluated partially, as far as to the point where values or actions are initiated |
References UVariable::copy(), UVarCalcOper::evaluateOperator(), UVarCalcOper::evaluateV(), UVariable::getElementCnt(), UVarCalcOper::getVar(), UVarCalcOper::insertOperator(), UVariable::isString(), MAX_ERROR_SIZE, UVarCalcOper::num, UVarCalcOper::parent, UVarCalcOper::remVar(), UVarCalcOper::right, UVarCalcOper::setValue(), and UVariable::setValues().
Referenced by UMisRuleState::createParameterVar(), UMisLoop::evalCondition(), UMisControl::evaluateCondition(), UMisCaseSwitch::evaluateExpr(), UMisAssign::execute(), UMisIf::execute(), UFunctionVarPool::handleVarValues(), UMisRuleState::methodCall(), UMisRuleState::methodCallV(), and UMisRuleState::step().
|
inline |
Get variable assignment as specified in this line.
cmdLine | The line from where to start the evaluation (line is not changed) syntax error the errorText() is set with a description.. Get error text |
Referenced by UMisControl::evaluateCondition(), UMisAssign::execute(), UMisControl::execute(), UFuncKeep::handleKeep(), UMisAssign::setLine(), UMisIf::setLine(), UMisBreak::setLine(), UMisLoop::setLine(), UMisCaseSwitch::setLine(), UMisCase::setLine(), and UMisCall::setLine().
|
inline |
Get error text max length
References MAX_ERROR_SIZE.
Referenced by UMisAssign::execute(), UMisAssign::setLine(), UMisIf::setLine(), UMisBreak::setLine(), UMisLoop::setLine(), UMisCaseSwitch::setLine(), UMisCase::setLine(), and UMisCall::setLine().
bool UVarCalc::getIdentifier | ( | const char * | id, |
int | idCnt, | ||
const char * | allowed, | ||
const char ** | oChar | ||
) |
Is the next n characters from 'var' a valid identifier. an identifier starts with a character and may continue with a sequence of characters, numbers or one of '_$'
id | pointer to the first character to be evaluated - assumed not to be zero terminated. |
idCnt | maximum number of characters to be evaluated. |
allowed | is any special characters allowed after initial alpha character - typical "_" |
oChar | is set to the first char not belonging to a identifier |
Referenced by UMisRuleState::createParameterVar(), UMisAssign::setLine(), UMisBreak::setLine(), UMisCall::setLine(), and testCalc().
|
protectedvirtual |
Evaluate system specific functions - that need to know position of planner etc. The called function name is in 'name' the parameters in 'pars' and if the function returns a value it must be put in 'value' Get value from a local function variable (a parameter). true if a variable exist, and
bool UVarCalc::getValueAnyD | ( | UVarPool * | scope, |
const char * | name, | ||
double * | value, | ||
const char ** | params | ||
) |
Get value for the variable or function call with this name Variables and functions in the local scope has first priority, then gradually one scope at a time until root scope. After that the math scope is tested. true if found.
scope | the scope to be searched for value (normally just from 'getVarPool()') |
value | the found (double) value is returned here (if not NULL). |
params | at this position are the parameters for the function, if parameters are used (and can be evaluated) then the character position are modified to just passed the end bracket for the parameter. |
References UVarPool::callLocal(), UVarPool::getLocalValue(), UVarPool::getParentVarPoolScope(), UVarPool::getRootVarPool(), and UVarPool::getStruct().
bool UVarCalc::getValueAnyV | ( | UVarPool * | scope, |
const char * | name, | ||
UVariable * | value, | ||
const char ** | params | ||
) |
Get value for the variable or function call with this name Variables and functions in the local scope has first priority, then gradually one scope at a time until root scope. After that the math scope is tested. true if found.
scope | the scope to be searched for value (normally just from 'getVarPool()') |
value | the found value is returned here (if not NULL). |
params | at this position are the parameters for the function, if parameters are used (and can be evaluated) then the character position are modified to just passed the end bracket for the parameter. |
References UVarPool::callLocalV(), UVariable::copy(), UVarPool::getLocalVariable(), UVarPool::getParentVarPoolScope(), UVarPool::getRootVarPool(), UVarPool::getStruct(), UVariable::getValued(), UVariable::getValues(), UVariable::isString(), UVariable::setValued(), UVariable::setValues(), and UVarCalcOper::value.
Get the variable with this name in the specified scope (incl. math) Variables in the local scope has first priority, then gradually one scope at a time until root scope. After that the math scope is tested. true if found.
scope | the scope to be searched for value (normally just from 'getVarPool()') |
name | is the name of the variable |
value | the found (double) value is returned here (if not NULL). |
References UVariable::copy(), UVarPool::getLocalVariable(), UVarPool::getParentVarPoolScope(), UVarPool::getRootVarPool(), UVarPool::getStruct(), and UVarCalcOper::value.
bool UVarCalc::getVariableRefAny | ( | UVarPool * | scope, |
const char * | name, | ||
UVariable ** | found, | ||
int * | nameIndex | ||
) |
Get reference to variable with this name in the specified scope (incl. math) Variables in the local scope has first priority, then gradually one scope at a time until root scope. After that the math scope is tested. true if found.
scope | the scope to be searched for value (normally just from 'getVarPool()') |
name | is the name of the variable (may include index - is returned in nameIndex |
found | the found variable is returned here (if not NULL). |
nameIndex | is any optional index in the variable name string (if not NULL) if variable is found, but no index, then set to -1. if no variable, then not changed. |
References UVarPool::getLocalVariable(), UVarPool::getParentVarPoolScope(), UVarPool::getRootVarPool(), and UVarPool::getStruct().
bool UVarCalc::isDefined | ( | UVarPool * | scope, |
const char * | varName | ||
) |
Is this variable defined in the scope. The test is for variables and structures, and in the provided scope as well as any parent scope. further the math scope is tested too.
Copy values of all variables to logfile The varPool has methods, and a call to one of these are needed. Do the call now and return (a double sized) result in 'value' and return true if the method call is allowed.
scope | the scope variable pool at the deepest level. |
varName | variable name (or struct name) that may include a '.' for sub-structure. |
References UVarPool::getParentVarPoolScope(), UVarPool::getStruct(), and UVarPool::getStructDeep().
bool UVarCalc::isRemark | ( | const char * | string | ) |
Returns a help string for general function 'index' and the number of general functions in 'count'. Get a (or try to) value from the connected MRC. Returns false if variable is unknown or MRC is not connected Is this string to be regarded as a remark line? Returns true if so. A remark line start with one of "%#;" or "//"
Referenced by UMisRuleState::runRuleCommands().
bool UVarCalc::setResource | ( | UResBase * | resource, |
bool | remove | ||
) |
Called by server core when new resources are available.
Add standard math methods
resource | is the offered resource pointer |
remove | is true if the resource is unloaded and thuis no longer valid |
Referenced by UResRuleState::UResRuleState().
|
protected |
Error string, when an error is detected
Referenced by UMisRuleState::createParameterVar(), UMisRuleState::initCall(), UKeepItem::monitorTest(), UMisRuleState::runBreak(), UMisRuleState::runEnable(), UMisRuleState::runLines(), UMisRuleState::runSwitch(), and UMisRuleState::step().