AURobotServers
4
|
#include <ufunctionvarpool.h>
Public Member Functions | |
virtual void | createResources () |
virtual bool | handleCommand (UServerInMsg *msg, void *extra) |
virtual bool | setResource (UResBase *resource, bool remove) |
UFunctionVarPool () | |
~UFunctionVarPool () | |
Public Member Functions inherited from UFunctionBase | |
bool | addResource (UResBase *resource, UFunctionBase *owner) |
void | closeLogfile () |
virtual const char * | commandList () |
const char * | getAliasName () |
const char * | getLoadedFileName () |
void * | getLoadedModuleRef () |
virtual bool | gotAllResources (char *missingThese, int missingTheseCnt) |
bool | isMine (const char *cmdName) |
bool | isStatic () |
is the module loaded as static A module is static if the ldFilename has a length of zero. More... | |
virtual const char * | name () |
bool | newCmd (UServerInMsg *newMsg, UDataBase *extra) |
bool | newCommand (UServerInMsg *newMsg, void *extra) |
bool | openLogfile (const char *name) |
void | print (const char *preString) |
virtual void | resourceUpdated () |
bool | sendEndTag (UServerInMsg *msg) |
bool | sendEndTag () |
bool | sendFullTag (const char *attributes) |
bool | sendHelpDone (UServerInMsg *msg) |
bool | sendHelpDone () |
bool | sendHelpStart (UServerInMsg *msg, const char *subject) |
bool | sendHelpStart (const char *subject) |
bool | sendHelpStart () |
bool | sendMsg (UServerInMsg *msg, const char *message, int size) |
bool | sendMsg (const char *message) |
bool | sendMsg (UServerInMsg *msg, const char *message) |
bool | sendMsg (int clientIdx, const char *message, int size) |
bool | sendMsgInt (int clientIdx, const char *message) |
bool | sendStartTag (const char *attributes) |
bool | sendText (UServerInMsg *msg, const char *text) |
bool | sendText (const char *text) |
virtual void | setAliasName (const char *name) |
virtual void | setCommand (const char *cmdList, const char *name, const char *note) |
void | setLoadedModuleRef (void *module, const char *moduleFileName) |
virtual void | setLoadTime (UTime) |
void | setName (const char *name) |
void | setVerbose (bool value) |
UFunctionBase () | |
virtual | ~UFunctionBase () |
Public Member Functions inherited from UCallBack | |
bool | addOnEvent (UOnEvent *dataObject) |
virtual bool | onEvent (const char *interface, const char *dataType, void *data) |
UCallBack () | |
virtual | ~UCallBack () |
Public Member Functions inherited from UResVarPool | |
int | addMethod (const char *formalName, const char *paramTypes, const char *comment) |
int | addMethodV (const char *formalName, const char *paramTypes, const char *comment) |
UVarPool * | addStruct (const char *name, const char *comment, bool copy=false) |
UVariable * | addVar (const char *name, const double initialValue, const char *type, const char *comment) |
UVariable * | addVar (const char *name, const char *initialValue, const char *type, const char *comment) |
UVariable * | addVarA (const char *name, const char *initialValue, 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) |
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) |
bool | callVS (const char *function, const char *stringParam) |
int | callVSCD (const char *function, const char *strPar, UDataBase *data, int cooSys) |
void | createBaseVar () |
virtual bool | createVarSpace (const int varCnt, const int structCnt, const int methCnt, const char *note, bool copy=false) |
bool | getGlobalString (const char *name, const char **value) |
bool | getGlobalValue (const char *name, double *value) |
bool | getGlobalValue (const char *name, const char **value) |
bool | getGlobalValue (const char *name, bool *value) |
bool | getGlobalValue (const char *name, UTime *value) |
bool | getLocalValue (const char *name, double *value) |
get a value in this variable tree More... | |
bool | getLocalValue (const char *name, bool *value) |
bool | getLocalValue (const char *name, UTime *value) |
double | getLocalValue (int idx) |
UPosition | getLocalValue3D (int idx) |
UPosRot | getLocalValue6D (int idx) |
bool | getLocalValueBool (int idx) |
int | getLocalValueInt (int idx) |
UTime | getLocalValueTime (int idx) |
const char * | getLogFileName () |
const char * | getVarDescription (int idx) |
UVarCalc * | getVarPool () |
bool | isLogFileOpen () |
bool | isLogFileOpen (const char *structName) |
bool | isVarPoolUpdated (int lastCnt, int *newCnt) |
void | logFileClose () |
bool | logFileOpen () |
void | logFileStart (const char *structName, bool open) |
virtual bool | methodCall (const char *name, const char *paramOrder, char **strings, const double *doubles, double *value, UDataBase **returnStruct=NULL, int *returnStructCnt=NULL) |
virtual const char * | print (const char *preString, char *buff, int buffCnt) |
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 (int idx, double value, const int element) |
bool | setLocalVar (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 | setLocalVar3D (int idx, UPosition *value) |
bool | setLocalVar6D (int idx, UPosRot *value) |
bool | setLocalVarAdd (int idx, double value, const int element) |
bool | setLocalVarPose (int idx, UPose *value) |
void | setVarPool (UVarCalc *sharedVarPool) |
int | updateQTvars (int structIdx) |
UResVarPool () | |
virtual | ~UResVarPool () |
Public Member Functions inherited from UResBase | |
void | createReplayVar (UVarPool *pool) |
UCmdExe * | getCorePointer () |
char * | getLogFileName (char *fn, const int fnCnt) |
int | getResFuncIdx () |
const char * | getResID () |
int | getResVersion () |
bool | isA (const char *idStr) |
bool | isAlsoA (const char *id) |
virtual void | saveSettings () |
void | setCorePointer (UCmdExe *serverCore) |
void | setResFuncIdx (int idx) |
virtual void | setResID (const char *id, const int version) |
virtual void | stop (bool) |
virtual void | updateReplayStatus () |
UResBase () | |
virtual | ~UResBase () |
Public Member Functions inherited from UReplay | |
void | addChild (UReplay *child) |
virtual bool | decodeReplayLine (char *) |
char * | getLogFileName (char *fn, const int fnCnt) |
char * | getReplayFileName (char *fn, const int fnCnt) |
int | getReplayLogLine () |
bool | isReplay () |
bool | isReplayFileOpen () |
void | removeChild (UReplay *child) |
virtual void | replayAdvanceTime (UTime untilTime) |
void | replaySetBaseFileName (const char *name, const char *preName="") |
void | replaySetFileName (const char *name) |
virtual bool | replayStep () |
int | replayStep (int steps) |
virtual bool | replayToTime (UTime untilTime) |
void | setParent (UReplay *parent) |
bool | setReplay (bool value) |
UReplay () | |
virtual | ~UReplay () |
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 UVarMethodImplement | |
virtual bool | methodCallV (const char *name, const char *paramOrder, UVariable *params[], UDataBase **returnStruct, int *returnStructCnt) |
virtual | ~UVarMethodImplement () |
Protected Member Functions | |
bool | handleVar (UServerInMsg *sg, void *extra) |
bool | handleVarPush (UServerInMsg *msg) |
bool | handleVarValues (UServerInMsg *msg, UVarCalc *vp, const char *attName, const char *attValue, const char *type, bool andDesc) |
bool | initCallReturnStructType (UDataBase **rParOrg, const int MRP, char *returnStructType) |
void | makeAMethodCall (UServerInMsg *msg, char *aCallStr, char *returnStructType) |
void | sendAllVar (UServerInMsg *msg, UVarCalc *varPool, const char *structPreName, bool andDesc) |
void | sendDescription (UServerInMsg *msg, const char *prestring, const char *desc) |
bool | sendVar (UServerInMsg *msg, UVariable *vv, const char *structPreName, bool andDesc, const char *extra) |
bool | sendVarList (UServerInMsg *msg, UVarPool *vp, bool andDesc, bool asSingle) |
Protected Member Functions inherited from UFunctionBase | |
int | getCmdIndex () |
UResBase * | getStaticResource (const char *resName, bool mayCreate, bool staticOnly=true) |
get a pointer to a static resource. More... | |
bool | isClientAlive (int clientIdx, double holdOffTime) |
bool | sendDebug (UServerInMsg *msg, const char *debugText) |
bool | sendDebug (const char *debugText) |
bool | sendError (UServerInMsg *msg, const char *errorText) |
bool | sendError (const char *errorText) |
bool | sendHelp (UServerInMsg *msg, const char *infoText) |
bool | sendHelp (const char *infoText) |
bool | sendInfo (UServerInMsg *msg, const char *infoText) |
bool | sendInfo (const char *infoText) |
bool | sendWarning (UServerInMsg *msg, const char *warningText) |
bool | sendWarning (const char *warningText) |
UResBase * | setThisResource (const char *ID, UResBase *resource, bool remove, bool *changed, UResBase *currentResPtr, bool *isLocal) |
Protected Member Functions inherited from UResVarPool | |
void | setDescription (const char *note, bool copy=false) |
Protected Member Functions inherited from UResBase | |
UResBase * | getStaticResource (const char *resName, bool mayCreate, bool staticOnly=true) |
get a pointer to a static resource. More... | |
Protected Attributes | |
UResVarPool * | varPool |
Protected Attributes inherited from UFunctionBase | |
char | aliasName [MAX_ID_LENGTH] |
UCmdExe * | cmdHandler |
char * | cmdToks [20] |
int | cmdToksCnt |
char | commandsHandled [MAX_RESOURCE_LIST_SIZE] |
UServerInMsg * | msg |
char | pluginName [MAX_RESOURCE_LIST_SIZE] |
bool | verboseMessages |
Protected Attributes inherited from UResBase | |
int | resFuncIdx |
char | resID [MAX_RESOURCE_ID_LENGTH] |
char | resIsAlso [MAX_RESOURCE_ISALSO_LENGTH] |
int | resVersion |
Protected Attributes inherited from UReplay | |
bool | replay |
FILE * | replayFile |
char | replayFileName [REPLAY_FILE_NAME_LENGTH] |
replay filename More... | |
char | replayLine [MAX_LOG_LINE_LENGTH] |
int | replayLogLine |
UReplay * | replayParent |
UTime | replayTimeNext |
Private Attributes | |
int | leftMargin |
Additional Inherited Members | |
Static Public Member Functions inherited from UResVarPool | |
static const char * | getResClassID () |
Public Attributes inherited from UFunctionBase | |
bool | silent |
is reply to client and console to be limited More... | |
Public Attributes inherited from UReplay | |
bool | replayTimeAdvancePending |
UTime | replayTimeNow |
Static Public Attributes inherited from UFunctionBase | |
static const int | MAX_ID_LENGTH = 30 |
static const int | MAX_RESOURCE_LIST_SIZE = 250 |
Static Protected Attributes inherited from UReplay | |
static const int | MAX_LOG_LINE_LENGTH = 10000 |
static const int | REPLAY_FILE_NAME_LENGTH = 264 |
max length of replay filename More... | |
Interface function to handle local variables and var structures from other ressources.
@author Christian <chrand@mail.dk>
UFunctionVarPool::UFunctionVarPool | ( | ) |
Constructor
References leftMargin, UFunctionBase::setCommand(), and varPool.
UFunctionVarPool::~UFunctionVarPool | ( | ) |
Destructor
References varPool.
|
virtual |
Called by server after this module is integrated into the server core structure, i.e. all core services are in place, but no commands are serviced for this module yet. Create any resources that this modules needs and add these to the resource pool to be integrated in the global variable pool and method sharing. Remember to add to resource pool by a call to addResource(UResBase * newResource, this). This module must also ensure that any resources creted are deleted (in the destructor of this class) Resource shut-down code should be handled in the resource destructor.
Reimplemented from UFunctionBase.
References UFunctionBase::addResource(), UResVarPool::UResVarPool(), and varPool.
|
virtual |
Handle incomming command (intended for command separation) Must return true if the function is handled - otherwise the client will get a failed - reply
Reimplemented from UFunctionBase.
References handleVar(), handleVarPush(), USmlTagIn::isTagA(), UFunctionBase::sendDebug(), and UServerInMsg::tag.
|
protected |
Handle command 'var' and all its options
References bool2str(), USmlTagIn::getAttValue(), UVarPool::getFullPreName(), UVarPool::getGlobalVariable(), UVarLog::getLogFilename(), UResVarPool::getLogFileName(), USmlTagIn::getNextAttribute(), UVarPool::getStructDeep(), UResVarPool::getVarPool(), handleVarValues(), UVarLog::hasHist(), UVarLog::hist, UResVarPool::isLogFileOpen(), UVarPool::isLogfileOpen(), ULogFile::isLogOpen(), UResVarPool::logFileClose(), UResVarPool::logFileOpen(), UResVarPool::logFileStart(), makeAMethodCall(), MAX_SML_NAME_LENGTH, MAX_STRUCT_NAMES, MAX_VAR_NAME_SIZE, UVariable::openVarLog(), USmlTagIn::reset(), UFunctionBase::sendError(), UFunctionBase::sendHelpDone(), UFunctionBase::sendHelpStart(), UFunctionBase::sendInfo(), UFunctionBase::sendText(), sendVarList(), UFunctionBase::sendWarning(), str2bool2(), UServerInMsg::tag, and varPool.
Referenced by handleCommand().
|
protected |
Handle push commands
References UServerPush::addPushCommand(), bool2str(), UFunctionBase::cmdHandler, USmlTagIn::getAttValue(), UServerPush::getPushCmdCnt(), UVarPool::getStructDeep(), USmlTagIn::getTagName(), UResVarPool::getVarPool(), UServerPush::gotCmdExe(), MAX_STRUCT_NAMES, MAX_VAR_NAME_SIZE, UServerPush::print(), UFunctionBase::sendHelpDone(), UFunctionBase::sendHelpStart(), UFunctionBase::sendInfo(), UFunctionBase::sendMsg(), UFunctionBase::sendText(), UFunctionBase::sendWarning(), UServerPush::setCmdExe(), UServerInMsg::tag, and varPool.
Referenced by handleCommand().
|
protected |
Handle this variable set or request. If a structure with no name is specified, then 'aStruct' will be set true.
andDesc | if true, then the variable description is send too |
References UVarPool::addVar(), UVarPool::addVarA(), bool2str(), UVarCalc::evaluateV(), USmlTagIn::getAttBool(), USmlTagIn::getAttDouble(), USmlTagIn::getAttInteger(), USmlTagIn::getAttValue(), UVarPool::getFullPreName(), UVarPool::getLocalVar(), UVarPool::getLocalVariable(), UVarPool::getLocalVarIndex(), UReplay::getReplayFileName(), UVarPool::getStructDeep(), UServerInMsg::getTag(), USmlTagIn::getTagName(), UVariable::getValuesAsString(), UVarLog::hasHist(), UVarLog::hist, UVariable::isString(), UVariable::isTypeA(), UVariable::m2, UVariable::makeTimeSeries(), MAX_STRUCT_NAMES, MAX_VAR_NAME_SIZE, UVarHist::minUpdTime, UVariable::name, UReplay::replayStep(), UVarHist::rowMaxCnt, UFunctionBase::sendInfo(), UFunctionBase::sendMsg(), sendVar(), UVariable::setAll(), UVariable::setDescription(), UVarLog::setMaxUpdateRate(), UReplay::setReplay(), UVarLog::setReplay(), UVariable::setSize(), UVariable::setUnit(), UVariable::setValue(), UVariable::setValued(), UVariable::setValues(), UFunctionBase::silent, UServerInMsg::tag, and UResBase::var.
Referenced by handleVar().
|
protected |
Initialize this pointer array by structures if the type 'returnStructType'.
References UPoseV::getDataType(), UPose::getDataType(), UDataString::getDataType(), UPosition::getDataType(), ULineSegment::getDataType(), UPoseTime::getDataType(), UDataBase::isA(), and UResBase::var.
Referenced by makeAMethodCall().
|
protected |
Decode this string as a method call, do the call and return the result
References bool2str(), UResVarPool::callGlobal(), UResVarPool::callGlobalV(), USmlTagIn::getTagName(), initCallReturnStructType(), UFunctionBase::sendEndTag(), UFunctionBase::sendMsg(), UFunctionBase::sendText(), UFunctionBase::sendWarning(), UVariable::setDouble(), UVariable::setValues(), UDataBase::snprint(), UServerInMsg::tag, and varPool.
Referenced by handleVar().
|
protected |
Send a copy of all values in this var pool. The structures in the var pool are recursed. All variables are returned as tags with the appropriate data type.
msg | is the source message - for reply details |
varPool | is the vaiable list to send |
structPreName | is the name of the varpool |
andDesc | if true, then the variable description is send too. |
References UVarPool::getLocalVar(), UVarPool::getMethodCnt(), UVarPool::getPreName(), UVarPool::getStruct(), UVarPool::getStructCnt(), UVarPool::getVarsCnt(), ULock::lock(), MAX_STRUCT_NAMES, MAX_VAR_NAME_SIZE, sendVar(), and ULock::unlock().
Referenced by sendVarList().
|
protected |
Send the description part formatted with an open left margin and a ragged right margin
References leftMargin, UResBase::line, maxi(), mini(), and UFunctionBase::sendMsg().
Referenced by sendVarList().
|
protected |
Send value information for a single variable in this var pool.
msg | reference to the request and the return adress for the message |
vv | pointer to the variable to be handled |
structPreName | global structure specification |
andDesc | if true, then the variable description is send too |
extra | is an optional extra attribute to send with the reply. true if variable is found. |
References bool2str(), UVariable::cols(), UVariable::d2d, UVariable::d3d, UVariable::description, UVariable::dq, USmlTagIn::getAttBool(), USmlTagIn::getAttInteger(), USmlTagIn::getAttValue(), UTime::getForFilename(), UTime::getMicrosec(), UReplay::getReplayFileName(), UReplay::getReplayLogLine(), UTime::GetSec(), UTime::getSec(), UVariable::getSize(), UServerInMsg::getTag(), USmlTagIn::getTagName(), UVariable::getType(), UVariable::getTypeChar(), UVarHist::getUpdTime(), UVariable::getValued(), UVariable::getValuesAsString(), UVariable::getValuesAsStringQuoted(), UVarLog::hasHist(), UVarLog::hist, ULogFile::isLogOpen(), UReplay::isReplayFileOpen(), MAX_STRUCT_NAMES, MAX_VAR_NAME_SIZE, mini(), UVarHist::minUpdTime, UVariable::name, UVariable::pose, UVariable::rot, UVarHist::rowCnt, UVarHist::rowMaxCnt, UVariable::rows(), UFunctionBase::sendHelpDone(), UFunctionBase::sendHelpStart(), UFunctionBase::sendMsg(), UFunctionBase::sendText(), UFunctionBase::sendWarning(), UTime::setTime(), UFunctionBase::silent, str2xml(), UVariable::t, and UServerInMsg::tag.
Referenced by handleVarValues(), and sendAllVar().
|
protected |
Send a list of variables, either as XML tags (copy) or as help text
msh | is message for additional options. |
vp | is the strucure to list. |
andDesc | - send also the description. |
asSingle | - send as XML tags rather than help text. |
References UVariable::cols(), UVarMethod::description, UVarPool::getDescription(), UVarPool::getFullPreName(), UVarPool::getLocalMethod(), UVarPool::getLocalVar(), UVarPool::getMethodCnt(), UVarPool::getPreName(), UVarPool::getStruct(), UVarPool::getStructCnt(), UVariable::getValuesAsString(), UVariable::getValuesdAsString(), UVariable::getValuesmAsStringLimited(), UVarPool::getVarDescription(), UVarPool::getVarsCnt(), UVarLog::hasHist(), UVarLog::hist, ULogFile::isLogOpen(), UReplay::isReplayFileOpen(), UVariable::isString(), UVariable::isTypeA(), leftMargin, UVariable::m2, UVarMethod::name, UVariable::name, UVarMethod::paramOrder, UVarHist::rowMaxCnt, UVariable::rows(), sendAllVar(), sendDescription(), UFunctionBase::sendInfo(), UFunctionBase::sendMsg(), UFunctionBase::sendWarning(), and UVarMethod::valid().
Referenced by handleVar().
|
virtual |
Set resource pointer - especially any resources acting af a var pool too
Reimplemented from UFunctionBase.
References UVarPool::addStruct(), UVarPool::deleteStruct(), UResVarPool::getResClassID(), UResBase::getResID(), UResVarPool::getVarPool(), UResBase::isA(), UResBase::isAlsoA(), UFunctionBase::setResource(), and varPool.
|
private |
Was the resource created locally Margin for variable name and value when sending variable list
Referenced by sendDescription(), sendVarList(), and UFunctionVarPool().
|
protected |
pointer to UVarCalc resource
Referenced by createResources(), handleVar(), handleVarPush(), makeAMethodCall(), setResource(), UFunctionVarPool(), and ~UFunctionVarPool().