AURobotServers
4
|
#include <urespoly.h>
Public Member Functions | |
UPolyItem * | add (const char *name) |
UPolyItem * | add (const char *name, const double x, const double y, const double z=0.0) |
const char * | codePolysXml (const char *tagName, char *buf, const int bufCnt, UTime updatedSince) |
bool | codePolyXml (const char *tagName, char *buf, const int bufCnt, UTime updatedSince, int idx) |
virtual const char * | commandList () |
virtual void | createResources () |
bool | del (const char *name) |
UPolyItem * | getItem (const char *name) |
UPolyItem * | getItem (int idx) |
const char * | getList (const char *preStr, char *buff, const int buffCnt) |
UPolyItem * | getNext (int p1, int *p2, const char *name) |
int | getPolysCnt () |
void | gotNewData () |
virtual void | handleNewData (USmlTag *tag, const char *ifname) |
virtual bool | methodCall (const char *name, const char *paramOrder, char **strings, const double *pars, double *value, UDataBase **returnStruct, int *returnStructCnt) |
virtual bool | methodCallV (const char *name, const char *paramOrder, UVariable *params[], UDataBase **returnStruct=NULL, int *returnStructCnt=NULL) |
virtual const char * | print (const char *preString, char *buff, int buffCnt) |
UResPoly () | |
void | UResPolyInit () |
virtual | ~UResPoly () |
Public Member Functions inherited from UResIfBase | |
UResIfBase () | |
~UResIfBase () | |
Public Member Functions inherited from UClientFuncBase | |
virtual void | changedNamespace (const char *newNamespace) |
virtual void | doTimeTick () |
int | getMsgCnt () |
bool | getVerbose () |
virtual const char * | name () |
bool | sendMsg (UClientPortSml *cnn, const char *buff, int buffCnt) |
bool | sendMsg (UClientPortSml *cnn, const char *buff) |
void | setVerbose (bool value) |
UClientFuncBase () | |
virtual | ~UClientFuncBase () |
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 () |
virtual bool | gotAllResources (char *missingThese, int missingTheseCnt) |
bool | isLogFileOpen () |
bool | isLogFileOpen (const char *structName) |
bool | isVarPoolUpdated (int lastCnt, int *newCnt) |
void | logFileClose () |
bool | logFileOpen () |
void | logFileStart (const char *structName, bool open) |
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) |
virtual bool | setResource (UResBase *resource, bool remove) |
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 | print (const char *preString) |
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 | ~UVarMethodImplement () |
Public Member Functions inherited from ULogFile | |
void | closeLog () |
void | doFlush () |
FILE * | getF () |
const char * | getLogFileName () |
const char * | getLogName () |
bool | isLogOpen () |
bool | isOpen () |
void | logLock () |
bool | logRename (const char *name) |
void | logUnlock () |
bool | openLog () |
bool | openLog (bool doOpen) |
bool | openLog (const char *resName) |
void | setLogFlush (bool doFlush) |
void | setLogName (const char *resName, const char *ext="log") |
void | setLogNameNumber (int number) |
add a number to the logfile name, That is if the logName is 'svs' and number is 2 (and logPath is '/rhome/demo'), then logfilename is set to '/rhome/demo/svs_2.log'. The purpose is to have an alternative, if the file renaming fails (if the file system is locked or something). More... | |
void | setLogTime (UTime timestamp) |
void | toLog (const char *logString) |
void | toLog (const char *s1, const char *s2) |
void | toLog (const int num, const char *s1, const char *s2) |
void | toLog (const char *s1, const int num, const char *s2) |
void | toLog (const char *s1, const int n1, const int n2, const char *s2) |
void | toLog (const char *s1, const int num, const char *s2, const char *s3) |
void | toLog (const char *s1, const int n1, const int n2, const char *s2, const char *s3) |
ULogFile () | |
void | useLogTime (bool value) |
~ULogFile () | |
Public Attributes | |
bool | verbose |
Public Attributes inherited from UClientFuncBase | |
ULock | decodeLock |
Public Attributes inherited from UReplay | |
bool | replayTimeAdvancePending |
UTime | replayTimeNow |
Protected Member Functions | |
void | createBaseVar () |
Protected Member Functions inherited from UClientFuncBase | |
void | handleHelp (USmlTag *tag) |
void | printReply (USmlTagIn *tag, const char *preString) |
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... | |
Static Protected Attributes | |
static const int | MAX_POLYS_CNT = 1000 |
maximum number of polys More... | |
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... | |
Additional Inherited Members | |
Static Public Member Functions inherited from UResVarPool | |
static const char * | getResClassID () |
This is the shared resource class. It must enherit from the resource base class (or one of its decendents) as shown.
|
inline |
Constructor
|
virtual |
Destructor
UPolyItem * UResPoly::add | ( | const char * | name | ) |
Add a new poly item
name | is the name of the new item. The name must be unique, |
References UPolygon::getPointsCnt(), ULock::lock(), UPolygon::setAsPolyline(), UPolyItem::setName(), ULock::unlock(), and UPolyItem::UPolyItem().
Referenced by ULineMatch::addToPoly(), UFuncPoly::handleCommand(), UFuncLoca2::handleCommand(), UFuncLocalize::handleLocalize(), UFuncBall::makeDisplayPolygon(), and UFuncImSeg::makeDisplayPolygon().
UPolyItem * UResPoly::add | ( | const char * | name, |
const double | x, | ||
const double | y, | ||
const double | z = 0.0 |
||
) |
Add a new poly item
name | is the name of a new or existing item. Names are unique, |
x,y,z | is a position that is added to the end of the item points, z is optional. |
References UPolygon::add(), UPolygon::clear(), UPolygon::getPointsCnt(), ULock::lock(), UPolygon::setAsPolyline(), UPolyItem::setName(), UPolyItem::setUpdated(), ULock::unlock(), and UPolyItem::UPolyItem().
const char * UResPoly::codePolysXml | ( | const char * | tagName, |
char * | buf, | ||
const int | bufCnt, | ||
UTime | updatedSince | ||
) |
code all polygons to an XML message into this buffer
tagName | is the name to the tag, in wich the polygons are to be listed. |
buff | is the buffer, where to write the code. |
buffCnt | is the size of the buffer |
updatedSince | only items updated later than this is XML packed |
References buf, UPolyItem::codeXML(), and UPolyItem::updateTime.
bool UResPoly::codePolyXml | ( | const char * | tagName, |
char * | buf, | ||
const int | bufCnt, | ||
UTime | updatedSince, | ||
int | idx | ||
) |
code all polygons to an XML message into this buffer
tagName | is the name to the tag, in wich the polygons are to be listed. |
buff | is the buffer, where to write the code. |
buffCnt | is the size of the buffer |
updatedSince | only items updated later than this is XML packed |
idx | is index to the polygon to code. |
References buf, UPolyItem::codeXML(), and UPolyItem::updateTime.
Referenced by UFuncPoly::handleCommand().
|
inlinevirtual |
Function, that shall return a string with all handled commands, i.e. should return "gmk gmk2d guidemark", if commands starting with any of these three keywords are handled by this function
Reimplemented from UClientFuncBase.
References UPolyItem::name, and UPolyItem::print().
|
protected |
Make the variables that will be available to other plugins
|
virtual |
Create any resources that this modules needs This method is called after the resource is registred by the server.
Reimplemented from UResBase.
bool UResPoly::del | ( | const char * | name | ) |
Delete a poly, that is, set vertex count to 0 This marks that the polygon is empty and the polygon slot may be reused.
name | is the name of the poly |
References UPolygon::clear(), ULock::lock(), and ULock::unlock().
Referenced by UFuncPoly::handleCommand().
UPolyItem * UResPoly::getItem | ( | const char * | name | ) |
Get poly item pointer
name | is the name of the poly |
Referenced by ULineMatch::addToPoly(), UFuncLoca2::correlateLines(), UFuncLoca2::handleCommand(), UFuncLocalize::handleLocalize(), UFuncBall::makeDisplayPolygon(), UFuncImSeg::makeDisplayPolygon(), and UNavPaint::paintPolyItems().
|
inline |
get an item by index, NB no range check
idx | the index to the items available, should be in the range 0..getPolysCnt()-1. |
References UPolygon::add().
const char * UResPoly::getList | ( | const char * | preStr, |
char * | buff, | ||
const int | buffCnt | ||
) |
Get list of current polys
preStr | is a short string, that is added at the start of the buffer. |
buff | is the buffer, where to write the list. |
buffCnt | is the size of the buffer |
Referenced by UFuncPoly::handleCommand().
UPolyItem * UResPoly::getNext | ( | int | p1, |
int * | p2, | ||
const char * | name | ||
) |
Get poly item pointer starting at index 'p1'
p1 | is the first polygon to search for the next name that matches 'name' |
p2 | is set (if not NULL) to the next polygon after the found |
name | is the name of the poly |
References UPolyItem::match().
Referenced by UFuncLocalize::handleAddLine(), UFuncLoca2::handleAddLine(), and UFuncPoly::handleCommand().
|
inline |
Get number of current poly processes
References buf.
Referenced by UFuncPoly::handleCommand(), and UNavPaint::paintPolyItems().
void UResPoly::gotNewData | ( | ) |
Tell a display plugin that new data exist - for a potential redraw.
Referenced by ULineMatch::addToPoly(), UFuncLoca2::correlateLines(), UFuncPoly::handleCommand(), UFuncLocalize::handleLocalize(), UFuncBall::makeDisplayPolygon(), and UFuncImSeg::makeDisplayPolygon().
|
virtual |
Got fresh data from a stream destined to this function. that is, the received XML tag is in the commandList() for this resource.
Reimplemented from UClientFuncBase.
References UPolygon::add(), UPolyItem::cooSys, USmlTagIn::getAttBool(), USmlTagIn::getAttDouble(), USmlTagIn::getAttInteger(), USmlTagIn::getAttValue(), USmlTagIn::getNextAttribute(), USmlTag::getNextTag(), USmlTag::getPolygon(), USmlTagIn::getTagName(), UPose::h, USmlTagIn::isAStartTag(), USmlTagIn::isTagA(), USmlTagIn::isTagAnEnd(), MAX_SML_NAME_LENGTH, UPolyItem::MNL, UPolyItem::name, UTime::now(), UPolyItem::relPose, UPolyItem::relPoseUse, USmlTag::skipToEndTag(), UPolyItem::updateTime, UPolyItem::valid, UPose::x, and UPose::y.
|
virtual |
The varPool has methods, and a call to one of these is needed. Do the call now and return (a double sized) result in 'value' and return true if the method call is allowed. If the returnStruct and returnStructCnt is not NULL, then a number (no more than initial value of returnStructCnt) of structures based on UDataBase may be returned into returnStruct array of pointers. The returnStructCnt should be modified to the actual number of used pointers (if needed). If the call is allowed, but the result is invalid for some reason, the return value 'value' can be set to som agreed value, (e.g. 0.0 (false) and 1.0 for true).
Reimplemented from UResVarPool.
References UPolygon::add(), UPosition::clear(), UPolygon::getPoint(), UPolygon::getPointsCnt(), UPolyItem::isA(), roundi(), and UVariable::set3D().
|
virtual |
A varPool method with this class as implementor is called.
name | is the name of the called function |
paramOrder | is a string with one char for each parameter in the call - d is double, s is string, c is class object. |
params | is an array of variable pointers with the actual parameters, in the order specified by order |
returnStruct | is an array of class object pointers that can return values or objects (may be NULL) if no result value is needed (a procedure call) |
returnStructCnt | is the number of objects in the returnStruct buffer |
Reimplemented from UVarMethodImplement.
References UPolygon::add(), UPosition::clear(), UPolyItem::cooSys, UPolygon::copyTo(), UVariable::get3D(), UVariable::getInt(), UPolygon::getPoint(), UPolygon::getPointsCnt(), UVariable::getPose(), UPolyItem::isA(), UDataBase::isAlsoA(), UPolygon::isInsideConvex(), UPolygon::remove(), roundi(), UVariable::set3D(), UPolygon::setAsPolygon(), UPolygon::setAsPolyline(), UVariable::setBool(), UPolyItem::setUpdated(), UPosition::x, UPose::x, UPosition::y, UPose::y, and UPosition::z.
|
virtual |
print status to a string buffer
Reimplemented from UResVarPool.
void UResPoly::UResPolyInit | ( | ) |
Initialize resource
|
staticprotected |
maximum number of polys
|
protected |
array of poly handles
|
protected |
Number of polys allocated.
|
protected |
inform a potential display plugin, that new data is available
|
protected |
number of established poly items
|
protected |
last update time for polygons
bool UResPoly::verbose |
Is the resource to output verbose message to console
Referenced by UFuncPoly::handleCommand().