AURobotServers
4
|
#include <uvarpool.h>
Public Member Functions | |
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 | |
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 | |
const char * | description |
ULogFile * | logVar |
ULock * | logVarLock |
UVarPool ** | varPools |
bool * | varPoolsLocal |
bool | verbose |
Private Attributes | |
char * | descriptionCopy |
UVarMethod * | meths |
int | methsCnt |
int | methsMaxCnt |
UVarPool * | parentVarPool |
UVarPool * | parentVarPoolScope |
char | preName [MAX_VAR_NAME_SIZE] |
char | preNameFull [MAX_VAR_NAME_SIZE *MAX_STRUCT_NAMES] |
int | varPoolsCnt |
int | varPoolsMaxCnt |
UVariable ** | vars |
int | varsCnt |
int | varsMaxCnt |
This structure holds access to variables and functions. Variables can be either in this class or in a list of pointers to other instances of this class. In the end the value should be evaluated to a double. The lock is to protect pointers and values during access an var-space search. The Push class is to enable command execution on variable update.
UVarPool::UVarPool | ( | ) |
Constructor
References descriptionCopy, logVar, meths, methsCnt, methsMaxCnt, parentVarPool, parentVarPoolScope, preName, preNameFull, varPools, varPoolsCnt, varPoolsLocal, varPoolsMaxCnt, vars, varsCnt, and varsMaxCnt.
Referenced by addStructLocal().
|
virtual |
Destructor
References deleteAll(), descriptionCopy, meths, varPools, varPoolsLocal, and vars.
int UVarPool::addMethod | ( | UVarMethodImplement * | implementor, |
const char * | formalName, | ||
const char * | paramTypes, | ||
const char * | comment | ||
) |
Add a method to this local var pool, and implemented by this implementor. the function uses double array and string array to hold parameters (deprecated)
implementor | is a pointer to a class that has a UVarMethodImplement ansestor |
name | of method to add - may be in a sub-structure using a '.' notation |
paramTypes | is a string with the parameter types (string (s) or double (d). |
comment | is intended as an online help description |
References addMethod(), createFunctionStack(), getLocalMethod(), getStructDeep(), MAX_VAR_NAME_SIZE, meths, methsCnt, methsMaxCnt, and UVarMethod::setMethod().
Referenced by UResVarPool::addMethod(), addMethod(), UResCamIf::createBaseVar(), UResLaserIf::createBaseVar(), UResLaserIfRoad::createBaseVar(), UMisRuleState::createBaseVar(), and getMethodMax().
int UVarPool::addMethodV | ( | UVarMethodImplement * | implementor, |
const char * | formalName, | ||
const char * | paramTypes, | ||
const char * | comment | ||
) |
Add a method to this local var pool, and implemented by this implementor. The method is of the type that acceps parameters of the UVariable type.
implementor | is a pointer to a class that has a UVarMethodImplement ansestor |
name | of method to add - may be in a sub-structure using a '.' notation |
paramTypes | is a string with the parameter types (string (s) or double (d). |
comment | is intended as an online help description |
References addMethodV(), createFunctionStack(), getLocalMethod(), getStructDeep(), MAX_VAR_NAME_SIZE, meths, methsCnt, methsMaxCnt, and UVarMethod::setMethodV().
Referenced by UResRuleState::addMathMethods(), UResVarPool::addMethodV(), addMethodV(), UMisRuleState::createBaseVar(), UResRuleState::createBaseVar(), and getMethodMax().
int UVarPool::addStruct | ( | const char * | name, |
UVarPool * | varStruct | ||
) |
Add a set of variables as a new structure with this pre-name
References createVarPoolStack(), getPreName(), getStruct(), maxi(), setParentVarPool(), setPreName(), UServerPush::setUpdated(), varPools, varPoolsCnt, varPoolsLocal, and varPoolsMaxCnt.
Referenced by UResKeep::add(), UFunctionVarPool::setResource(), and UMisRuleState::setRule().
int UVarPool::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.
name | new name to call the structure |
toVarStruct | pointer to the existing var structure |
References createVarPoolStack(), getStruct(), maxi(), UServerPush::setUpdated(), varPools, varPoolsCnt, varPoolsLocal, and varPoolsMaxCnt.
UVarPool * UVarPool::addStructLocal | ( | const char * | name, |
const char * | note, | ||
bool | copy | ||
) |
Add a new local (empty) structure. A description may be added to this variable structure (including methods)
name | is the new name of the struct. |
note | is a description of the structure |
copy | - set to true if description is not available as static value - then pace for a copy of the string is allocated on heap. |
References createVarPoolStack(), createVarSpace(), getStruct(), maxi(), setParentVarPool(), setPreName(), UServerPush::setUpdated(), UVarPool(), varPools, varPoolsCnt, varPoolsLocal, and varPoolsMaxCnt.
Referenced by UNamedBoxes::addBox(), UResRuleState::addMathMethods(), UResVarPool::addStruct(), UResCamIfGmk::createBaseVar(), getMethodMax(), getStructDeep(), UResCamIfCam::gotNewData(), and UFunctionCamGmk::handleGmkGetCommand().
UVariable * UVarPool::addVar | ( | const char * | name, |
const double | initialValue, | ||
const char * | type, | ||
const char * | comment | ||
) |
Add a symbol to to the symbol stack. The comment is intended as an online help for this variable.
name | is the new name to be added |
initialValue | is the value to be assigned to the variable |
type | is a cahracter version of the data type |
comment | is a pointer to a static instance of a string describing the variable the new variable |
References UVariable::d, UVariable::none, and UVariable::typeFromChar().
Referenced by UResRuleState::addMathMethods(), addVar(), UResVarPool::addVar(), addVarA(), UResCamIfCam::createBaseVar(), UResCamIfGmk::createBaseVar(), UResCamIfImg::createBaseVar(), UResCamIf::createBaseVar(), UResLaserIfSf::createBaseVar(), UResIfVar::createBaseVar(), UKeepItem::createBaseVar(), UResLaserIf::createBaseVar(), UResAvoid::createBaseVar(), UResLaserIfRoad::createBaseVar(), UMisRuleState::createBaseVar(), UResNavIfMan::createBaseVar(), UResKeep::createBaseVar(), UMisSeqRoot::createBaseVar(), UFakeDevice::createBaseVars(), ULaserDevice::createBaseVars(), UNamedBox::createGlobalVariables(), UNamedBoxes::createGlobalVariables(), UImgPush::createLocalVariables(), UMisRuleState::createParameterVar(), UResBase::createReplayVar(), UCamPush::createVars(), UCamDevBase::createVars(), UResCamIfCam::gotNewData(), UFunctionCamGmk::handleGmkGetCommand(), UFunctionVarPool::handleVarValues(), setLocalVar(), setScopeVar(), UCmdExe::sysModuleCmd(), UCamDevGuppy::~UCamDevGuppy(), and UCamDevIeee1394::~UCamDevIeee1394().
UVariable * UVarPool::addVar | ( | const char * | name, |
const double | initialValue, | ||
UVariable::varType | type, | ||
const char * | comment, | ||
const char * | attValue = NULL |
||
) |
Add a symbol to to the symbol stack (if not there already). The comment is intended as an online help for this variable.
name | is the new name to be added |
initialValue | is the (initial) value to be assigned to the variable |
type | is the data type - enumerated |
comment | is a pointer to a static instance of a string describing the variable |
attValue | is a string representation of the value(s), if NULL, then value is in initialValue the new variable (may be an existing with the same name) |
References addVar(), UVariable::isDouble(), UVariable::isString(), UVariable::setType(), UVariable::setValued(), and UVariable::setValues().
Add a symbol to to the symbol stack (if not there already). The comment is the online help for this variable.
name | is the new name to be added |
source | is the variable to be used as source |
comment | is a pointer to a static instance of a string describing the variable the new variable (or an existing with the same name). |
References addVar(), createVarStack(), UVariable::description, getLocalVariable(), getStructDeep(), MAX_VAR_NAME_SIZE, UVariable::setName(), UVariable::setParent(), UVariable::setValue(), vars, varsCnt, and varsMaxCnt.
UVariable* UVarPool::addVar | ( | const char * | name, |
const char * | comment | ||
) |
Add a symbol to to the symbol stack (if not there already). No value nor variable type is set. The comment is the online help for this variable.
name | is the new name to be added, if name has a '.' then a structure is created |
comment | is a pointer to a static instance of a string describing the variable the variable with name and comment set, returns NULL is not created |
UVariable * UVarPool::addVarA | ( | const char * | name, |
const char * | attValue, | ||
const char * | type, | ||
const char * | comment | ||
) |
Add an array (double array or string) symbol to the symbol stack. The comment is the online help for this variable.
name | is the new name to be added |
attValue | is a string representation of the value(s) |
type | is a character version of the data type |
comment | is a pointer to a static instance of a string describing the variable the new variable (may be an existing with the same name). |
References addVar(), UVariable::b, UVariable::d, UVariable::none, UVariable::s, and UVariable::typeFromChar().
Referenced by UResVarPool::addVar(), UKeepItem::createBaseVar(), UResAvoid::createBaseVar(), UFakeDevice::createBaseVars(), ULaserDevice::createBaseVars(), UNamedBox::createGlobalVariables(), UImgPush::createLocalVariables(), UCamRad::createVars(), UCamMounted::createVars(), UCamDevBase::createVars(), UFunctionVarPool::handleVarValues(), setLocalVar(), UCmdExe::sysModuleCmd(), and UCamDevGuppy::~UCamDevGuppy().
bool UVarPool::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.
name | is the name of the method, it may adress a sub structure, e.g. aa.bbbb |
paramOrder | the specific parameter order as a string, e.g "sdd" for three parameters the first 's' for string and the two last 'd's for double. |
strings | is an array of string pointers. as many of these string pointrs as there is 's' in the stringOrder should be valis and contain the string type parameters. |
doubles | is an array of doubles of at least the size of the number of 'd' in the paramOrder string. |
value | is where the direct return value are placed. It may be a value or a flag (true/false) of the success of the function. This pointer may be NULL. |
returnStruct | is an array of pointers to a datatype compatible with the UDataBase base type. This array pointer may be NULL. |
returnStructCnt | is a pointer to the number of entries in the returnStruct array. When the function returns this number will be modified to the actual number of values returned. |
References callScope(), and getRootVarPool().
Referenced by UResVarPool::callGlobal(), UServerPushQueue::doPushCall(), getParentVarPoolScope(), and UKeepItem::monitorTest().
bool UVarPool::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.
name | is the name of the method, it may adress a sub structure, e.g. aa.bbbb |
paramOrder | the specific parameter order as a string, e.g "sdd" for three parameters the first 's' for string and the two last 'd's for double. |
params | is an array of UVariable pointers. with the actual parameters |
returnStruct | is an array of pointers to a datatype compatible with the UDataBase base type. This array pointer may be NULL. |
returnStructCnt | is a pointer to the number of entries in the returnStruct array. When the function returns this number will be modified to the actual number of values returned. |
References callScopeV(), and getRootVarPool().
Referenced by getParentVarPoolScope().
bool UVarPool::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.
name | is the name of the method, it may adress a sub structure, e.g. aa.bbbb |
paramOrder | the specific parameter order as a string, e.g "sdd" for three parameters the first 's' for string and the two last 'd's for double. |
strings | is an array of string pointers. as many of these string pointrs as there is 's' in the stringOrder should be valis and contain the string type parameters. |
doubles | is an array of doubles of at least the size of the number of 'd' in the paramOrder string. |
value | is where the direct return value are placed. It may be a value or a flag (true/false) of the success of the function. This pointer may be NULL. |
returnStruct | is an array of pointers to a datatype compatible with the UDataBase base type. This array pointer may be NULL. |
returnStructCnt | is a pointer to the number of entries in the returnStruct array. When the function returns this number will be modified to the actual number of values returned. |
References getLocalMethod(), and UVarMethod::methodCall().
Referenced by UResVarPool::callLocal(), callScope(), getParentVarPoolScope(), and UVarCalc::getValueAnyD().
bool UVarPool::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.
name | is the name of the method, it may adress a sub structure, e.g. aa.bbbb |
paramOrder | the specific parameter order as a string, e.g "sdd" for three parameters the first 's' for string and the two last 'd's for double. |
params | is an array of UVariable pointers - same number as paramOrder string length. |
returnStruct | is an array of pointers to a datatype compatible with the UDataBase base type. This array pointer may be NULL. If NULL, then no return value is returned. Should be at least one element to get a result, first return struccture should be a UVariable, the rest could be data. |
returnStructCnt | is a pointer to the number of entries in the returnStruct array. When the function returns this number will be modified to the actual number of values returned. |
References getLocalMethod(), and UVarMethod::methodCallV().
Referenced by callScopeV(), UMisControl::execute(), getParentVarPoolScope(), and UVarCalc::getValueAnyV().
bool UVarPool::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.
name | is the name of the method, it may adress a sub structure, e.g. aa.bbbb |
paramOrder | the specific parameter order as a string, e.g "sdd" for three parameters the first 's' for string and the two last 'd's for double. |
strings | is an array of string pointers. as many of these string pointrs as there is 's' in the stringOrder should be valis and contain the string type parameters. |
doubles | is an array of doubles of at least the size of the number of 'd' in the paramOrder string. |
value | is where the direct return value are placed. It may be a value or a flag (true/false) of the success of the function. This pointer may be NULL. |
returnStruct | is an array of pointers to a datatype compatible with the UDataBase base type. This array pointer may be NULL. |
returnStructCnt | is a pointer to the number of entries in the returnStruct array. When the function returns this number will be modified to the actual number of values returned. |
References callLocal(), getParentVarPoolScope(), and getStruct().
Referenced by callGlobal(), and getParentVarPoolScope().
bool UVarPool::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.
name | is the name of the method, it may adress a sub structure, e.g. aa.bbbb |
paramOrder | the specific parameter order as a string, e.g "sdd" for three parameters the first 's' for string and the two last 'd's for double. |
params | is an array of UVariable pointers. with the actual parameters |
returnStruct | is an array of pointers to a datatype compatible with the UDataBase base type. This array pointer may be NULL. |
returnStructCnt | is a pointer to the number of entries in the returnStruct array. When the function returns this number will be modified to the actual number of values returned. |
References callLocalV(), getParentVarPoolScope(), and getStruct().
Referenced by UResVarPool::callGlobalV(), callGlobalV(), UMisControl::execute(), getParentVarPoolScope(), UMisRuleState::initCall(), and UMisRuleState::runRuleCommands().
|
protected |
Create the stack of references to functions that can be called to evaluate double variables. Returns true if space is allocated for 'maxCount' functions
References ULock::lock(), meths, methsCnt, methsMaxCnt, and ULock::unlock().
Referenced by addMethod(), addMethodV(), createVarSpace(), and getLogVarLock().
|
protected |
Create the stack of references to other var-pools, that from this var-pool is seen as structures, as objects with variables and functions (and possibly other structures). Creates the maximum number of variables ever to be stored in this variable pool.
References ULock::lock(), ULock::unlock(), varPools, varPoolsCnt, varPoolsLocal, and varPoolsMaxCnt.
Referenced by addStruct(), addStructLink(), addStructLocal(), createVarSpace(), and getLogVarLock().
bool UVarPool::createVarSpace | ( | const int | varCnt, |
const int | structCnt, | ||
const int | methCnt, | ||
const char * | note, | ||
bool | copy | ||
) |
Create variable space for simple variables, structures and methods. A descriptive note may be added.
varCnt | is number of variables there should be allocated space fore (initially) |
structCnt | is number of structures there should be allocated space fore initially. |
methCnt | is number of methods there should be allocated space fore initially. |
note | is a textual description of this structure. |
copy | make copy of description, this should be set to true, if note is a local variable in the calling function. A local copy of the note string is then allocated. If note is a static string, then copy should be false. true if reqired space were created, otherwise false. |
References createFunctionStack(), createVarPoolStack(), createVarStack(), and setDescription().
Referenced by addStructLocal(), UResVarPool::createVarSpace(), getMethodMax(), and UMisRuleState::setRule().
|
protected |
Create the stack of local variables. Creates the maximum number of variables ever to be stored in this variable pool.
References ULock::lock(), ULock::unlock(), vars, varsCnt, and varsMaxCnt.
Referenced by addVar(), createVarSpace(), and getLogVarLock().
void UVarPool::deleteAll | ( | ) |
Delete all variables, sub-structures and methods in this var pool
References methsCnt, varPools, varPoolsCnt, varPoolsLocal, vars, and varsCnt.
Referenced by deleteStruct(), and ~UVarPool().
void UVarPool::deleteMethod | ( | const char * | name, |
const char * | paramStr | ||
) |
Delete the method with this name and parameter list
References UVarMethod::deleteMethod(), getLocalMethodIdx(), meths, and methsCnt.
void UVarPool::deleteMethods | ( | UVarMethodImplement * | owner | ) |
Delete all methods in this structure will be called if a resource that owns the variable structure is unloaded
References UVarMethod::deleteMethod(), deleteMethods(), UVarMethod::implementedBy, meths, methsCnt, varPools, and varPoolsCnt.
Referenced by deleteMethods().
void UVarPool::deleteStruct | ( | const char * | name | ) |
Delete a structure from the list of available varPools.
References deleteAll(), varPools, varPoolsCnt, and varPoolsLocal.
Referenced by UResKeep::add(), UResKeep::deleteKeep(), UMisRuleState::remove(), UMisRuleState::runCall(), UMisRuleState::runControl(), and UFunctionVarPool::setResource().
|
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'
Referenced by getLogVarLock().
|
inline |
Get the description note
References description, setDescription(), and setLogfile().
Referenced by UFunctionVarPool::sendVarList(), UQtgui::setStruct(), and UQtgui::updVarEvent().
const char * UVarPool::getFullPreName | ( | char * | name, |
const int | MNL | ||
) |
Return the prename for this group of variables down to the root
References getFullPreName(), parentVarPool, and preName.
Referenced by getFullPreName(), UFunctionVarPool::handleVar(), UFunctionVarPool::handleVarValues(), UVariable::openVarLog(), UNavPaint::paintVarDataText(), UFunctionVarPool::sendVarList(), UVariable::setUpdated(), and UQtgui::updVarEvent().
|
inline |
Return already compiled full prename
References preNameFull, setLocalVar(), and setLocalVarAdd().
Referenced by getPreName(), UMisRuleState::runLine(), UMisRuleState::runLines(), and setParentVarPool().
bool UVarPool::getGlobalString | ( | const char * | name, |
const char ** | value | ||
) |
Get global variable (string) value.
name | is the global name of the variable, this may have an index, i.e. core.servername[2], the returned string pointer then points to the third character in the servername. |
value | should be the adress of a const char pointer. |
References getGlobalVariable(), UVariable::getString(), and UVariable::isString().
Referenced by UResVarPool::getGlobalString(), and setLocalVarPose().
bool UVarPool::getGlobalValue | ( | const char * | name, |
double * | value | ||
) |
Get value for the variable with this name Returns true if variable is found, and in this case the value in 'value' (if not NULL)
References getGlobalVariable(), and UVariable::getValued().
Referenced by UResVarPool::getGlobalValue(), getGlobalValue(), and setLocalVarPose().
bool UVarPool::getGlobalValue | ( | const char * | name, |
bool * | value | ||
) |
Get a boolean value for the variable with this name in the global variable tree Returns true if variable is found, and in this case the value in 'value'
References getGlobalValue().
bool UVarPool::getGlobalValue | ( | const char * | name, |
UTime * | value | ||
) |
Get a time value for the variable with this name in the global variable tree Returns true if variable is found, and in this case returns time in 'value'
References getGlobalValue(), and UTime::setTime().
UVariable * UVarPool::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().
name | is the name of the variable, may include structure name |
element | is set to the array element specified in name, or 0 if not array. e.g. set to 3 in name is "imu.rot[3]". Element is set to -1, if name ends with '.sizeof' |
References getLocalVar(), getLocalVarIndex(), getRootVarPool(), getStructDeep(), and MAX_VAR_NAME_SIZE.
Referenced by UFuncTracking::FirstImage(), getGlobalString(), getGlobalValue(), getLogVarLock(), UFunctionVarPool::handleVar(), and UFuncTracking::TrackObjects().
UVarMethod * UVarPool::getLocalMethod | ( | const char * | name, |
const char * | paramList | ||
) |
Get pointer to method in this varPool under this name. returns NULL if not found.
References meths, methsCnt, UVarMethod::name, and UVarMethod::paramOrder.
Referenced by addMethod(), addMethodV(), callLocal(), callLocalV(), getLocalMethod(), UFunctionVarPool::sendVarList(), setGlobalVar(), and UQtgui::setStruct().
UVarPool * UVarPool::getLocalMethod | ( | const char * | name, |
const char * | paramList, | ||
UVarMethod ** | method | ||
) |
Get pointer to a method of this name, the method may be in a substructure. If a '.' notation is used, the relevant structure is found first. returns NULL if not found.
References getLocalMethod(), getStructDeep(), and MAX_VAR_NAME_SIZE.
UVarMethod * UVarPool::getLocalMethod | ( | const int | index | ) |
int UVarPool::getLocalMethodIdx | ( | const char * | name, |
const char * | paramList | ||
) |
Get index of this method in this var pool.
name | is then name (no structs allowed) of the method |
paramList | string with type specification of parameters d=double, s=string, c=class |
References meths, methsCnt, UVarMethod::name, and UVarMethod::paramOrder.
Referenced by deleteMethod(), and setGlobalVar().
double UVarPool::getLocalValue | ( | int | idx, |
int | element = 0 |
||
) |
Get value for this symbol.
idx | is the index to the variable in this var-pool |
element | is the array index, if this is an array, default is first element |
References UVariable::getValued(), vars, and varsCnt.
Referenced by UResVarPool::getLocalValue(), getLocalValue(), getScopeValue(), UVarCalc::getValueAnyD(), UFunctionDrivePos::handleDrivePos(), setGlobalVar(), setLocalVarPose(), and UResRoadDrive::setTarget().
bool UVarPool::getLocalValue | ( | const char * | name, |
double * | value | ||
) |
Get value when the specified name is relative to the local variable pool.
name | is the variable name, e.g. aaa.bbb.c |
value | is where the value is retuirned. 'value' may be NULL. if variable do not exist, then nothing is changed. |
References UVariable::getElementCnt(), getLocalVariable(), and UVariable::getValued().
bool UVarPool::getLocalValue | ( | const char * | name, |
bool * | value | ||
) |
Get a boolean value for the variable with this name in the local (this) variable tree Returns true if variable is found, and in this case the value in 'value'
References getLocalValue().
bool UVarPool::getLocalValue | ( | const char * | name, |
UTime * | value | ||
) |
Get a time value for the variable with this name in the local (this) variable tree Returns true if variable is found, and in this case returns time in 'value'
References getLocalValue(), and UTime::setTime().
UPosition UVarPool::getLocalValue3D | ( | int | idx | ) |
Get 3D position from this variables, assuming variable is an array with at least 3 elements
idx | is the index of the first variable, assuming the order x,y,z |
References UVariable::get3D(), and getLocalVar().
Referenced by UResVarPool::getLocalValue3D(), and setGlobalVar().
UPosRot UVarPool::getLocalValue6D | ( | int | idx | ) |
Get 6D position from 6 variables, starting with this index.
idx | is the index of the first of 6 variables, assuming the order x,y,z,Omage,Phi,Kappa. |
References UVariable::get6D(), and getLocalVar().
Referenced by UResVarPool::getLocalValue6D(), and setLocalVarPose().
bool UVarPool::getLocalValueBool | ( | int | idx | ) |
Get a boolean value
References UVariable::getValued(), vars, and varsCnt.
Referenced by UResVarPool::getLocalValueBool(), and setGlobalVar().
int UVarPool::getLocalValueInt | ( | int | idx | ) |
Get local value and return as integer.
References roundi(), vars, and varsCnt.
Referenced by UTermEmulator::addIfButtons(), and setGlobalVar().
UPose UVarPool::getLocalValuePose | ( | int | idx | ) |
Get 3D position to this variable as an array with 3 elements.
idx | is the index of the first variable, assuming the order x,y,h |
value | a pose with x,y,h |
References getLocalVar(), and UVariable::getPose().
Referenced by setLocalVarPose().
URotation UVarPool::getLocalValueRot | ( | int | idx | ) |
Get 3D rotation from this variables, assuming variable is an array with at least 3 elements.
idx | is the index of the first variable, assuming the order x,y,z |
References getLocalVar(), and UVariable::getRot().
Referenced by setGlobalVar().
UTime UVarPool::getLocalValueTime | ( | int | idx | ) |
Get the value as time
References UTime::clear(), UTime::setTime(), vars, and varsCnt.
Referenced by UResVarPool::getLocalValueTime(), and setGlobalVar().
|
inline |
Get pointer to a specific local variable
References vars.
Referenced by getGlobalVariable(), getLocalValue3D(), getLocalValue6D(), getLocalValuePose(), getLocalValueRot(), UFunctionVarPool::handleVarValues(), UFunctionVarPool::sendAllVar(), UFunctionVarPool::sendVarList(), setLocalVar3D(), setLocalVar6D(), setLocalVarRot(), UQtgui::setStruct(), UCmdExe::sysModuleCmd(), and UResVarPool::updateQTvars().
UVariable * UVarPool::getLocalVariable | ( | const char * | name, |
int * | element | ||
) |
get pointer to variable object in this variable tree
name | is the name of the variable, may include structure name (e.g. aaa.bbb.c) |
element | is set to the array element indicated by name (0 if no index specified) |
References getLocalVariable(), getLocalVarIndex(), getStructDeep(), MAX_STRUCT_NAMES, MAX_VAR_NAME_SIZE, mini(), and vars.
Referenced by UTermEmulator::addIfButtons(), addVar(), getLocalValue(), getLocalVariable(), UVarCalc::getValueAnyV(), UVarCalc::getVariableAny(), UVarCalc::getVariableRefAny(), UResIfVar::handleVar(), UFunctionVarPool::handleVarValues(), isLogfileOpen(), setLocalVar(), and setScopeVar().
int UVarPool::getLocalVarIndex | ( | const char * | name, |
int * | element | ||
) |
Get index for variable of this name
name | name of variable in this var-pool, may have array index |
element | if not NULL, then attary element index is returend here (0 is returned, if no index is specified). |
References MAX_VAR_NAME_SIZE, mini(), UVariable::splitNameIndex(), vars, and varsCnt.
Referenced by UTermEmulator::addIfButtons(), getGlobalVariable(), getLocalVariable(), getStructDeep(), UFunctionVarPool::handleVarValues(), setGlobalVar(), setLocalVar(), and UCmdExe::sysModuleCmd().
|
inline |
Get the pointer to the logfile if theis varpool structure needs logging
References logVar.
Referenced by UVariable::setUpdated().
|
inline |
Get the file lock to the log-file
References createFunctionStack(), createVarPoolStack(), createVarStack(), evaluateSystemFunction(), getGlobalVariable(), and logVarLock.
Referenced by UVariable::setUpdated().
|
inline |
Get count of available functions
References methsCnt.
Referenced by UFunctionIf::handleIf(), UFunctionLaserIfScan::handleLaserIf(), UResVarPool::print(), UFunctionVarPool::sendAllVar(), UFunctionVarPool::sendVarList(), UQtgui::setStruct(), and UResIfVar::snprint().
|
inline |
Get maximum number of functions - empty or used.
References addMethod(), addMethodV(), addStructLocal(), createVarSpace(), getStructDeep(), getVarDescription(), methsMaxCnt, setParentVarPool(), and setParentVarPoolScope().
Referenced by UFunctionIf::handleIf(), UResVarPool::print(), and UResIfVar::snprint().
|
inline |
Get parent var pool
References parentVarPool.
Referenced by getRootVarPool(), UMisRuleState::setRule(), and UQtgui::updVarEvent().
|
inline |
Get parent var pool - following the variable scope parent route
References callGlobal(), callGlobalV(), callLocal(), callLocalV(), callScope(), callScopeV(), getRootVarPool(), parentVarPool, and parentVarPoolScope.
Referenced by callScope(), callScopeV(), getScopeValue(), UVarCalc::getValueAnyD(), UVarCalc::getValueAnyV(), UVarCalc::getVariableAny(), UVarCalc::getVariableRefAny(), UVarCalc::isDefined(), and setScopeVar().
|
inline |
Return the prename for this group of variables
References getFullPreName(), and preName.
Referenced by addStruct(), UMisRuleState::getStateStr(), listVars(), UResVarPool::methodCall(), UResVarPool::print(), UFunctionVarPool::sendAllVar(), UFunctionVarPool::sendVarList(), UQtgui::updVarEvent(), and UQStandardItem::UQStandardItem().
UVarPool * UVarPool::getRootVarPool | ( | ) |
Get root var pool
References getParentVarPool().
Referenced by UResRuleState::addMathMethods(), callGlobal(), callGlobalV(), UResIfVar::createBaseVar(), getGlobalVariable(), getParentVarPoolScope(), getScopeValue(), UVarCalc::getValueAnyD(), UVarCalc::getValueAnyV(), UVarCalc::getVariableAny(), UVarCalc::getVariableRefAny(), UResIfVar::handleVar(), and setGlobalVar().
bool UVarPool::getScopeValue | ( | const char * | name, |
double * | value | ||
) |
Get a variable value in this var-pool or in any of the parent var-pools (in scope path) or in the math structure.
name | is the name of the variable, and may include '.' notation for sub-variables |
value | is where the value is to be returned |
References getLocalValue(), getParentVarPoolScope(), getRootVarPool(), and getStruct().
Referenced by isLogfileOpen().
UVarPool * UVarPool::getStruct | ( | const char * | name | ) |
Get pointer to variable of this name. returns NULL if not found. Get pointer to varPool structure of this name. returns NULL if not found.
References parentVarPool, varPools, and varPoolsCnt.
Referenced by UResKeep::add(), UResRuleState::addMathMethods(), addStruct(), addStructLink(), addStructLocal(), callScope(), callScopeV(), UCamPool::findDevices(), getScopeValue(), UMisRuleState::getStateStr(), getStructDeep(), UVarCalc::getValueAnyD(), UVarCalc::getValueAnyV(), UVarCalc::getVariableAny(), UVarCalc::getVariableRefAny(), UResCamIfCam::gotNewData(), UFunctionCamGmk::handleGmkGetCommand(), UVarCalc::isDefined(), listVars(), UCamPool::makeDevice(), UResVarPool::print(), UFunctionVarPool::sendAllVar(), UFunctionVarPool::sendVarList(), setGlobalVar(), UQtgui::setStruct(), UCmdExe::sysModuleCmd(), and UResVarPool::updateQTvars().
UVarPool * UVarPool::getStruct | ( | const int | idx | ) |
Get pointer to varPool structure with this index. returns NULL if not found.
References varPools, and varPoolsCnt.
|
inline |
Get count of structures (pointers to other UVarPool objects)
References varPoolsCnt.
Referenced by UMisRuleState::getStateStr(), UFunctionIf::handleIf(), UFunctionLaserIfScan::handleLaserIf(), listVars(), UResVarPool::print(), UFunctionVarPool::sendAllVar(), UFunctionVarPool::sendVarList(), UQtgui::setStruct(), UResIfVar::snprint(), and UResVarPool::updateQTvars().
UVarPool * UVarPool::getStructDeep | ( | const char * | fullName, |
char * | varName, | ||
const int | varNameCnt | ||
) |
Get a pointer to the structure thet (possibly) holds this variable or function. The full name may hold iteration through several structures, and the function will return the deepest level. I.e. road.leftSide.polyline should return a pointer to the 'leftSide' structure and the name 'polyline' in the varName string buffer. Returns a pointer to the relevant structure, and the remaining name in varName. Returns NULL if the structure is not found.
Referenced by addMethod(), addMethodV(), addVar(), UResIfVar::createBaseVar(), getGlobalVariable(), getLocalMethod(), getLocalVariable(), getMethodMax(), UFunctionVarPool::handleVar(), UResIfVar::handleVar(), UFunctionVarPool::handleVarPush(), UFunctionVarPool::handleVarValues(), UVarCalc::isDefined(), UResVarPool::isLogFileOpen(), UResVarPool::logFileStart(), UNavPaint::paintVarAdd(), UNavView::paintVarAdd(), and setLocalVar().
UVarPool * UVarPool::getStructDeep | ( | const char * | fullName, |
const bool | mayAdd, | ||
char * | varName, | ||
const int | varNameCnt | ||
) |
Get a pointer to the structure that (possibly) holds this variable or function. The full name may hold iteration through several structures, and the function will return the deepest level. I.e. road.leftSide.polyline should return a pointer to the 'leftSide' structure and the name 'polyline' in the varName string buffer. Returns a pointer to the relevant structure, and the remaining name in varName. Returns NULL if the structure is not found and mayAdd==false. Creates a new (empty) structure if mayAdd==true and the structure is not found.
References addStructLocal(), getLocalVarIndex(), getStruct(), MAX_STRUCT_NAMES, and MAX_VAR_NAME_SIZE.
int UVarPool::getStructIdx | ( | const char * | name | ) |
Get index for a structure for faster access and enumeration. Returns -1 if no such variable.
References varPools, and varPoolsCnt.
Referenced by setGlobalVar().
|
inline |
Get maximum number of structures (pointers to other UVarPool objects) - empty or used.
References varPoolsMaxCnt.
Referenced by UFunctionIf::handleIf(), UResVarPool::print(), and UResIfVar::snprint().
const char * UVarPool::getVarDescription | ( | int | idx | ) |
Get description for local variable with this index
References UVariable::description, vars, and varsCnt.
Referenced by getMethodMax(), UResVarPool::getVarDescription(), and UFunctionVarPool::sendVarList().
|
inline |
Get maximum number of variables and constants - used or unused.
References varsMaxCnt.
Referenced by UFunctionIf::handleIf(), UResVarPool::print(), and UResIfVar::snprint().
char * UVarPool::getVarName | ( | int | index | ) |
Get value for the variable or function call with this name Returns true if found, and value in 'value' (if not NULL). If not a variable, then a function return is tested, and the function parameters start at *params, this variable should be returned at end of parameters. Get name of variable with this name
References UVariable::name, vars, and varsCnt.
Referenced by setLocalVarPose().
|
inline |
Get pointer to first value in variable array. 'getVarsCnt()' returns size of array (the used part).
References vars.
Referenced by listVars(), and UNavPaint::paintVarDataText().
|
inline |
Get count of all variables and constants directly available, that is excluding structures.
References varsCnt.
Referenced by UFunctionIf::handleIf(), UFunctionLaserIfScan::handleLaserIf(), listVars(), UNavPaint::paintVarDataText(), UResVarPool::print(), UFunctionVarPool::sendAllVar(), UFunctionVarPool::sendVarList(), UQtgui::setStruct(), UResIfVar::snprint(), and UResVarPool::updateQTvars().
|
inline |
Test if this structure is open for data change logging
References getLocalVariable(), getScopeValue(), listVars(), logVar, and setScopeVar().
Referenced by UFunctionVarPool::handleVar(), and UResVarPool::isLogFileOpen().
|
inline |
void UVarPool::listVars | ( | const char * | preStr, |
char * | buff, | ||
const int | buffCnt, | ||
bool | andStructs | ||
) |
List variable in this structure into this buffer. One variable on each line, preceded by the preString.
preString | is to go in front of all variable lines |
buff | is the buffer for the result |
buffCnt | is the length of the buffer |
andStructs | lists also any sub-structures variables - if true |
References UTime::getDateString(), UTime::getDecSec(), getPreName(), getStruct(), getStructCnt(), UTime::getTimeAsString(), getVars(), getVarsCnt(), listVars(), UTime::now(), and UTime::setTime().
Referenced by UMisRuleState::getStateStr(), isLogfileOpen(), and listVars().
void UVarPool::setDescription | ( | const char * | note, |
bool | copy | ||
) |
Set the description note
copy | makes a copy of note, else the note pointer is used as is (i.e. pointes to a static string). |
References description, and descriptionCopy.
Referenced by UResBin::createBaseVar(), createVarSpace(), getDescription(), UResVarPool::setDescription(), and UResRuleState::UResRuleState().
|
inline |
Assigns a value to a variable. The variable may be a part of a structure.
name | is the name of the variable and may be a substructure, e.g. aa.bb.cc.d |
value | is the double value that should be assigned to the variable. |
mayAdd | If 'mayAdd' is true, then the variable is added if not found. And if the structure (any of the sspecified structures) is missing, then this is added too. |
References UVariable::d, getLocalMethod(), getLocalMethodIdx(), getLocalValue(), getLocalValue3D(), getLocalValueBool(), getLocalValueInt(), getLocalValueRot(), getLocalValueTime(), getLocalVarIndex(), getRootVarPool(), getStruct(), getStructIdx(), setLocalVar(), setLocalVar3D(), and setLocalVarRot().
Referenced by UResVarPool::setGlobalVar().
bool UVarPool::setLocalVar | ( | const int | index, |
const double | value, | ||
const int | element | ||
) |
Assigns a value to a variable
index | is the index of the variable in the local var-pool |
value | is the value to be assigned |
element | is the array index of the variable |
References UVariable::getValued(), UVariable::name, UServerPush::setUpdated(), UVariable::setValued(), vars, and varsCnt.
Referenced by UResCamIf::connectionChange(), UResLaserIf::connectionChange(), UResSmrIf::connectionChange(), getFullPreName(), UResIfVar::handleOther(), UResIfVar::handleVar(), setGlobalVar(), setLocalVar(), UResVarPool::setLocalVar(), setScopeVar(), UResRoadDrive::setTarget(), and UServerPort::updateVars().
bool UVarPool::setLocalVar | ( | const int | index, |
UVariable * | value | ||
) |
Assigns a value to a variable
index | is the index of the variable in the local var-pool |
value | is the variable with the value to be assigned |
References UVariable::copy(), UVariable::name, UServerPush::setUpdated(), vars, and varsCnt.
bool UVarPool::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.
name | is the name of the variable and may be a substructure, e.g. aa.bb.cc.d |
value | is the double value that should be assigned to the variable (when attValue==NULL). |
mayAdd | If 'mayAdd' is true, then the variable is added if not found. And if the structure (any of the sspecified structures) is missing, then this is added too. |
varTyp | the variable type. |
attValue | alternative source of values - set to NULL if no values |
References addVar(), getLocalVarIndex(), getStructDeep(), MAX_VAR_NAME_SIZE, and setLocalVar().
bool UVarPool::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.
name | is the name of the variable and may be a substructure and optionally have an index, e.g. aa.bb.cc.d[3] |
value | is a string with values to be added, starting with index indicated by name. |
mayAdd | If 'mayAdd' is true, then the variable is added if not found. And if the structure (any of the sspecified structures) is missing, then this is added too. |
varTyp | the variable type described as a string. |
updTime | is an optional update time (mostly relevant for time series variables) |
added | is set to true if a new variable is added (and added is not NULL) |
References addVarA(), getLocalVariable(), getStructDeep(), UVarLog::hasHist(), UVariable::isString(), UVariable::makeTimeSeries(), MAX_VAR_NAME_SIZE, UVariable::setValued(), UVariable::setValues(), and UTime::valid.
bool UVarPool::setLocalVar3D | ( | int | idx, |
UPosition * | value | ||
) |
Set 3D position to 3 to this variable as an array with 3 elements
idx | is the index of the variable, assuming the order x,y,z |
value | a position with x,y,z |
References getLocalVar(), UVariable::name, UVariable::set3D(), and UServerPush::setUpdated().
Referenced by setGlobalVar(), UResVarPool::setLocalVar3D(), and setLocalVarPose().
bool UVarPool::setLocalVar6D | ( | int | idx, |
UPosRot * | value | ||
) |
Set 6D position to 6 consecutive variables starting with this index.
idx | is the index of the first of 6 variables, assuming the order x,y,z,Omage,Phi,Kappa. |
value | the 6D value (x,y,z,o,p,k) |
References getLocalVar(), UVariable::name, UVariable::set6D(), and UServerPush::setUpdated().
Referenced by UResVarPool::setLocalVar6D(), and setLocalVarPose().
bool UVarPool::setLocalVarAdd | ( | const int | index, |
const double | value, | ||
const int | element | ||
) |
Add a value to a local variable
References UVariable::add(), UVariable::name, UServerPush::setUpdated(), vars, and varsCnt.
Referenced by getFullPreName(), and UResVarPool::setLocalVarAdd().
|
inline |
Set 3D position to this variable as an array with 3 elements.
idx | is the index of the first variable, assuming the order x,y,h |
value | a pose with x,y,h |
References getGlobalString(), getGlobalValue(), getLocalValue(), getLocalValue6D(), getLocalValuePose(), getVarName(), UPose::h, setLocalVar3D(), setLocalVar6D(), UPose::x, and UPose::y.
bool UVarPool::setLocalVarRot | ( | int | idx, |
URotation * | value | ||
) |
Set 3D rotation to this variable as an array with 3 elements.
idx | is the index of the variable, assuming the order x,y,z |
value | a rotation with rotation of axis x,y,z as Omega, Phi, Kappa |
References getLocalVar(), UVariable::name, UVariable::setRot(), and UServerPush::setUpdated().
Referenced by setGlobalVar().
Set logfile for this structure. The logfile is a pointer to a ULogFile structure. An additional logfile lock is provided too.
References ULogFile::isOpen(), ULock::lock(), logVar, logVarLock, preNameFull, UVariable::saveToLog(), ULock::unlock(), vars, and varsCnt.
Referenced by getDescription(), and UResVarPool::logFileStart().
void UVarPool::setParentVarPool | ( | UVarPool * | parent | ) |
Set parent var pool
References getFullPreName(), MAX_STRUCT_NAMES, MAX_VAR_NAME_SIZE, parentVarPool, and preNameFull.
Referenced by addStruct(), addStructLocal(), getMethodMax(), and UMisRuleState::setRule().
void UVarPool::setParentVarPoolScope | ( | UVarPool * | parent | ) |
Set parent var pool to be used when following variable scope in calculations
References parentVarPoolScope.
Referenced by getMethodMax().
bool UVarPool::setPreName | ( | const char * | name | ) |
Set the pre-name that (often) is placed in front of variables to indicate that the value belongs to this structure.
References MAX_VAR_NAME_SIZE, and preName.
Referenced by addStruct(), addStructLocal(), and UMisRuleState::setRule().
bool UVarPool::setScopeVar | ( | const char * | name, |
const double | value, | ||
bool | mayAdd | ||
) |
Set a variable in the scope to a value Scope is in this var-pool or any parent var-pool.
name | is the name of the variable - possibly with '.' notation. |
value | is the value to assign to the variable. |
mayAdd | if true the variable will be added to the local var-pool is not found in scope |
References UVariable::d, getParentVarPoolScope(), and setLocalVar().
Referenced by UMisAssign::execute(), and isLogfileOpen().
bool UVarPool::setScopeVar | ( | const char * | name, |
const UVariable * | source, | ||
bool | mayAdd | ||
) |
Set a variable in the scope to the value of source Scope is in this var-pool or any parent var-pool.
name | is the name of the variable - possibly with '.' notation. |
source | is the value to assign to the variable. |
mayAdd | if true the variable will be added to the local var-pool is not found in scope |
References addVar(), getLocalVariable(), getParentVarPoolScope(), and UVariable::setValue().
|
inline |
Set verbose flag
References verbose.
Referenced by UFunctionIf::handleIf(), and UFunctionLaserIfScan::handleLaserIf().
|
protected |
Description for this structure (used when displaying global variables)
Referenced by getDescription(), and setDescription().
|
private |
copy of description - if not literal
Referenced by setDescription(), UVarPool(), and ~UVarPool().
|
protected |
Logfile for variable updates
Referenced by getLogVar(), isLogfileOpen(), setLogfile(), and UVarPool().
|
protected |
Resource lock on logfile
Referenced by getLogVarLock(), and setLogfile().
|
private |
Available function calls in this var pool
Referenced by addMethod(), addMethodV(), createFunctionStack(), deleteMethod(), deleteMethods(), getLocalMethod(), getLocalMethodIdx(), UVarPool(), and ~UVarPool().
|
private |
Number of available function calls
Referenced by addMethod(), addMethodV(), createFunctionStack(), deleteAll(), deleteMethod(), deleteMethods(), getLocalMethod(), getLocalMethodIdx(), getMethodCnt(), and UVarPool().
|
private |
Maximum number of available function calls
Referenced by addMethod(), addMethodV(), createFunctionStack(), getMethodMax(), and UVarPool().
|
private |
Parent var pool
Referenced by getFullPreName(), getParentVarPool(), getParentVarPoolScope(), getStruct(), setParentVarPool(), and UVarPool().
|
private |
Parent var pool when evaluating variables
Referenced by getParentVarPoolScope(), setParentVarPoolScope(), and UVarPool().
|
private |
Variable pre-name, as in pre-name.variable
Referenced by getFullPreName(), getPreName(), setPreName(), and UVarPool().
|
private |
Variable pre-name, as in pre-name.variable
Referenced by getFullPreName(), setLogfile(), setParentVarPool(), and UVarPool().
|
protected |
Stack of structures with other variables subordinate to this structure.
Referenced by addStruct(), addStructLink(), addStructLocal(), createVarPoolStack(), deleteAll(), deleteMethods(), deleteStruct(), getStruct(), getStructIdx(), UVarPool(), and ~UVarPool().
|
private |
Count of subordinat varPool structures actually populated.
Referenced by addStruct(), addStructLink(), addStructLocal(), createVarPoolStack(), deleteAll(), deleteMethods(), deleteStruct(), getStruct(), getStructCnt(), getStructIdx(), and UVarPool().
|
protected |
array of boolean to indicate if the var pool is created locally.
Referenced by addStruct(), addStructLink(), addStructLocal(), createVarPoolStack(), deleteAll(), deleteStruct(), UVarPool(), and ~UVarPool().
|
private |
Space available for subordinat varPool structures.
Referenced by addStruct(), addStructLink(), addStructLocal(), createVarPoolStack(), getStructMax(), and UVarPool().
|
private |
Stack of variable
Referenced by addVar(), createVarStack(), deleteAll(), getLocalValue(), getLocalValueBool(), getLocalValueInt(), getLocalValueTime(), getLocalVar(), getLocalVariable(), getLocalVarIndex(), getVarDescription(), getVarName(), getVars(), setLocalVar(), setLocalVarAdd(), setLogfile(), UVarPool(), and ~UVarPool().
|
private |
Number of used variables
Referenced by addVar(), createVarStack(), deleteAll(), getLocalValue(), getLocalValueBool(), getLocalValueInt(), getLocalValueTime(), getLocalVarIndex(), getVarDescription(), getVarName(), getVarsCnt(), setLocalVar(), setLocalVarAdd(), setLogfile(), and UVarPool().
|
private |
Maximum number of variables
Referenced by addVar(), createVarStack(), getVarMax(), and UVarPool().
|
protected |
Print more to console if verbose is true
Referenced by isVarPoolVerbose(), setVerbose(), and UResKeep::UResKeepInit().