AURobotServers
4
|
#include <ureskeep.h>
Public Member Functions | |
bool | createBaseVar () |
UServerPush * | getPushHandle (bool on) |
bool | isA (const char *name) |
bool | isWait () |
bool | monitorTest (int exprFor, bool *evaluated=NULL) |
const char * | print (const char *preStr, char *buff, const int buffCnt) |
void | setAllow (double secs) |
void | setAllowOff (bool value) |
void | setCore (UCmdExe *pCore) |
void | setExpr (int expFor, const char *expr) |
void | setLogFile (ULogFile *logf) |
void | setName (const char *name) |
void | setWait (bool value) |
bool | tick () |
UKeepItem () | |
~UKeepItem () | |
Public Member Functions inherited from UVarCalc | |
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 Attributes | |
UCmdExe * | core |
pointer to server core (to send start and stop commands using "do") More... | |
UServerPush * | eventOff |
UServerPush * | eventOn |
ULogFile * | logfile |
UTime | offTime |
int | tickCnt |
UTime | tickTime |
UVariable * | varAllow |
allow this many seconds after start command is issued More... | |
UVariable * | varAllowOff |
allow off state to be stable More... | |
UVariable * | varKeepName |
pointer to name variable More... | |
UVariable * | varMonitorCnt |
number of monitorng actions More... | |
UVariable * | varOffCnt |
number of monitorng actions More... | |
UVariable * | varOffExpr |
pointer to expression to monitor More... | |
UVariable * | varOnExpr |
pointer to expression to monitor More... | |
UVariable * | varRunningOK |
pointer to result of monitoring process More... | |
UVariable * | varTickInterval |
UVariable * | varUnknownExpr |
pointer to expression to monitor More... | |
UVariable * | varWait |
pointer to wait variable for this keep More... | |
Protected Attributes inherited from UVarCalc | |
char | errorTxt [MAX_ERROR_SIZE] |
Protected Attributes inherited from UVarPool | |
const char * | description |
ULogFile * | logVar |
ULock * | logVarLock |
UVarPool ** | varPools |
bool * | varPoolsLocal |
bool | verbose |
Additional Inherited Members | |
Protected Member Functions inherited from UVarCalc | |
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) |
Class to hold the needed items to montor the state of a process or a server
UKeepItem::UKeepItem | ( | ) |
Constructor
References core, eventOff, eventOn, logfile, tickCnt, and UServerPush::UServerPush().
Referenced by UResKeep::add().
bool UKeepItem::createBaseVar | ( | ) |
Create the items base vaiables in a var pool
References UVarPool::addVar(), UVarPool::addVarA(), varAllow, varAllowOff, varKeepName, varMonitorCnt, varOffCnt, varOffExpr, varOnExpr, varRunningOK, varTickInterval, varUnknownExpr, and varWait.
Referenced by UResKeep::add(), UResKeep::getKeepsCnt(), getPushHandle(), and UResKeep::UResKeepInit().
|
inline |
Get a handle to a push object for process, or overall
References createBaseVar(), eventOff, eventOn, isA(), setAllow(), setAllowOff(), setCore(), setExpr(), setName(), and setWait().
Referenced by UFuncKeep::handleKeepPush(), and UResKeep::UResKeep().
bool UKeepItem::isA | ( | const char * | name | ) |
Test if this this keep matches the provided name
name | the proveded name to compare against |
References UVariable::getValues(), and varKeepName.
Referenced by getPushHandle().
|
inline |
Is this keep in wait mode
References UVariable::getValueBool(), monitorTest(), print(), and varWait.
Referenced by tick().
bool UKeepItem::monitorTest | ( | int | exprFor, |
bool * | evaluated = NULL |
||
) |
Update the monitoring process for this keep.
evaluated | is set to false if a syntax error is detected in the expression. |
References UVarPool::callGlobal(), UVarCalc::errorTxt, UVarCalc::evaluateD(), UVariable::getValues(), roundi(), varOffExpr, varOnExpr, and varUnknownExpr.
Referenced by UFuncKeep::handleKeep(), isWait(), and tick().
const char * UKeepItem::print | ( | const char * | preStr, |
char * | buff, | ||
const int | buffCnt | ||
) |
Print current status to this buffer string
preStr | start by inserting this string into buffer |
buff | start of buffer |
bufCnt | length of buffer |
References bool2str(), UVariable::getBool(), UVariable::getInt(), UVariable::getValued(), UVariable::getValues(), varAllow, varKeepName, varOffExpr, varOnExpr, varRunningOK, varTickInterval, varUnknownExpr, and varWait.
Referenced by isWait(), and UResKeep::UResKeep().
void UKeepItem::setAllow | ( | double | secs | ) |
Set number of seconds to allow a process to start (typically after an off condition)
secs | is number of seconds to wait before first monitoring action takes place. |
References UVariable::setDouble(), and varAllow.
Referenced by getPushHandle(), and UFuncKeep::handleKeep().
void UKeepItem::setAllowOff | ( | bool | value | ) |
Set number of seconds to allow a process to start (typically after an off condition)
value | allow off as a steady state, when value is true, otherwise an off condition will change state to unknown, and thus retrigger an off event after the allowed allow (to start) time. |
References UVariable::setBool(), and varAllowOff.
Referenced by getPushHandle(), and UFuncKeep::handleKeep().
void UKeepItem::setCore | ( | UCmdExe * | pCore | ) |
Set the receiver of the event commands (the implementor)
implementor | implements the commands |
References core, eventOff, eventOn, and UServerPush::setImplementor().
Referenced by UResKeep::add(), and getPushHandle().
void UKeepItem::setExpr | ( | int | expFor, |
const char * | expr | ||
) |
Set the expression that the keep function is to monitor.
expFor | which of the three expressions are to be set -1=unknown, 0=off, 1=on |
expr | is the expression that should evaluate to true (exp > 0.5) when process is OK. |
References UVariable::setValues(), varOffExpr, varOnExpr, and varUnknownExpr.
Referenced by getPushHandle(), and UFuncKeep::handleKeep().
|
inline |
Set pointer to the resource logfile
Referenced by UResKeep::add().
void UKeepItem::setName | ( | const char * | name | ) |
Set the name of the keep process - may also be the process to keep.
name | is the symbol name of the keep process. |
References UVariable::setValues(), and varKeepName.
Referenced by UResKeep::add(), and getPushHandle().
void UKeepItem::setWait | ( | bool | value | ) |
Set the (server) command to be issued, to start the (not running) process Set the (server) command to be issued, to stop the (not running) process Send the stop command now. If wait is true, then this will terminate the process. If wait is false, then this will restart the process Set the wait flag. If waiting, then the monitoring of this keep is off (and no action taken) When the flag is switched on, then the monitoring is restarted.
value | is the new value for the wait flag. |
References UVariable::setBool(), and varWait.
Referenced by UResKeep::getKeepsCnt(), getPushHandle(), and UFuncKeep::handleKeep().
bool UKeepItem::tick | ( | ) |
Update the process monitor for this connection
References UVariable::add(), eventOff, eventOn, UVariable::getBool(), UTime::getTimePassed(), UVariable::getValued(), UVariable::getValueInt(), UVariable::getValues(), isWait(), logfile, monitorTest(), UTime::now(), offTime, UVariable::setInt(), UServerPush::setUpdated(), tickCnt, tickTime, ULogFile::toLog(), varAllow, varAllowOff, varKeepName, varMonitorCnt, varOffCnt, varOffExpr, varOnExpr, varRunningOK, varTickInterval, and varUnknownExpr.
Referenced by UResKeep::run().
|
protected |
pointer to server core (to send start and stop commands using "do")
Referenced by UResKeep::createResources(), setCore(), and UKeepItem().
|
protected |
on process is on handler
Referenced by UResKeep::createResources(), getPushHandle(), UResKeep::getPushHandle(), setCore(), tick(), UKeepItem(), UResKeep::UResKeepInit(), ~UKeepItem(), and UResKeep::~UResKeep().
|
protected |
on process is on handler
Referenced by getPushHandle(), setCore(), tick(), UKeepItem(), UResKeep::UResKeep(), and ~UKeepItem().
|
protected |
logfile to save events
Referenced by tick(), and UKeepItem().
|
protected |
Client connection to the other server number of iterations
Referenced by tick(), and UKeepItem().
|
protected |
allow this many seconds after start command is issued
Referenced by createBaseVar(), print(), setAllow(), and tick().
|
protected |
allow off state to be stable
Referenced by createBaseVar(), setAllowOff(), and tick().
|
protected |
pointer to name variable
Referenced by createBaseVar(), isA(), print(), setName(), and tick().
|
protected |
number of monitorng actions
Referenced by createBaseVar(), and tick().
|
protected |
number of monitorng actions
Referenced by createBaseVar(), and tick().
|
protected |
pointer to expression to monitor
Referenced by createBaseVar(), monitorTest(), print(), setExpr(), and tick().
|
protected |
pointer to expression to monitor
Referenced by createBaseVar(), monitorTest(), print(), setExpr(), and tick().
|
protected |
pointer to result of monitoring process
Referenced by createBaseVar(), print(), and tick().
|
protected |
interval between ticks
Referenced by createBaseVar(), print(), and tick().
|
protected |
pointer to expression to monitor
Referenced by createBaseVar(), monitorTest(), print(), setExpr(), and tick().
|
protected |
pointer to wait variable for this keep
Referenced by createBaseVar(), UResKeep::createBaseVar(), UResKeep::getKeepList(), isWait(), print(), UResKeep::run(), setWait(), and UResKeep::setWait().