AURobotServers  4
Public Member Functions | Public Attributes | Protected Member Functions | Protected Attributes | Static Protected Attributes | List of all members
UResPcp Class Reference

#include <urespcp.h>

Inheritance diagram for UResPcp:
Inheritance graph

Public Member Functions

UPcpItemadd (const char *name)
 
UPcpItemadd (const char *name, const double x, const double y, const double z=0.0)
 
UPcpItemadd (const char *name, UPcpItem::POINT_CLOUD_TYPE type)
 
bool codePcpXml (const char *tagName, char *buf, const int bufCnt, int idx)
 
virtual const char * commandList ()
 
UPcpItemcopy (pcl::PointCloud< pcl::PointXYZ > *source, const char *name)
 
UPcpItemcopy (pcl::PointCloud< pcl::PointXYZRGB > *source, const char *name)
 
virtual void createResources ()
 
bool del (const char *name)
 
UPcpItemgetItem (const char *name)
 
UPcpItemgetItem (int idx)
 
UPcpItemgetItemXYZ (const char *name)
 
const char * getList (const char *preStr, char *buff, const int buffCnt)
 
UPcpItemgetNext (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)
 
bool savePCD (const char *idName, const char *filename)
 
 UResPcp ()
 
void UResPcpInit ()
 
virtual ~UResPcp ()
 
- 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)
 
UVarPooladdStruct (const char *name, const char *comment, bool copy=false)
 
UVariableaddVar (const char *name, const double initialValue, const char *type, const char *comment)
 
UVariableaddVar (const char *name, const char *initialValue, const char *type, const char *comment)
 
UVariableaddVarA (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)
 
UVarCalcgetVarPool ()
 
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)
 
UCmdExegetCorePointer ()
 
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
UResBasegetStaticResource (const char *resName, bool mayCreate, bool staticOnly=true)
 get a pointer to a static resource. More...
 

Protected Attributes

UPcpItempcps [MAX_POLYS_CNT]
 array of pcp handles More...
 
int pcpsCnt
 Number of pcps allocated. More...
 
UVariablevarCallDispOnNewData
 inform a potential display plugin, that new data is available More...
 
UVariablevarPolyCnt
 number of established pcp items More...
 
UVariablevarUpdTime
 last update time for pcpgons More...
 
- Protected Attributes inherited from UClientFuncBase
int msgHandled
 
char serverNamespace [MAX_SML_NAME_LENGTH]
 
int serverNamespaceValue
 
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
 
UReplayreplayParent
 
UTime replayTimeNext
 
- Protected Attributes inherited from ULogFile
int failCnt
 
FILE * logFile
 
ULock logFileLock
 
char logFileName [MAX_FILENAME_SIZE]
 
bool logFlush
 
char logName [MAX_FILENAME_SIZE]
 
UTime logTime
 
bool logTimeUse
 

Static Protected Attributes

static const int MAX_POLYS_CNT = 1000
 maximum number of pcps 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 ()
 

Detailed Description

This is the shared resource class.

This class implements a point cloud pool (PCP) All pool items has an ID - a text string (< 32 chars) and is also used by the AUVIEW opengl 3D viewer) The items can be retrieved by other plugins for on-line viewing/saving through this plugin

Author
Christian Andersen

Constructor & Destructor Documentation

UResPcp::UResPcp ( )
inline

Constructor

References UResBase::setResID(), UResPcpInit(), and ~UResPcp().

UResPcp::~UResPcp ( )
virtual

Destructor

Referenced by UResPcp().

Member Function Documentation

UPcpItem * UResPcp::add ( const char *  name)

Add a new pcp item

Parameters
nameis the name of the new item. The name must be unique,
Returns
a pointer to the new item, or null if it exist already, or could not be added.

References UPcpItem::getPointsCnt(), ULock::lock(), UPcpItem::setAsPolyline(), UPcpItem::setName(), ULock::unlock(), and UPcpItem::UPcpItem().

Referenced by copy(), getItem(), and UFuncPcp::handleCommand().

UPcpItem * UResPcp::add ( const char *  name,
const double  x,
const double  y,
const double  z = 0.0 
)

Add a new XYZ position to this cloud, creates cloud if none exist.

Parameters
nameis the name of a new or existing item. Names are unique,
x,y,zis a position that is added to the end of the item points, z is optional.
Returns
a pointer to the item, or null if it do not exist and could not be added.

References UPcpItem::add(), UPcpItem::deleteCloud(), UPcpItem::getPointsCnt(), UPcpItem::isXYZ(), ULock::lock(), UPcpItem::makeCloud(), UPcpItem::PointXyz, UPcpItem::setAsPolyline(), UPcpItem::setName(), UPcpItem::setUpdated(), ULock::unlock(), UPcpItem::UPcpItem(), UPosition::x, UPosition::y, and UPosition::z.

UPcpItem * UResPcp::add ( const char *  name,
UPcpItem::POINT_CLOUD_TYPE  type 
)

Add a new (empty) cloud item

Parameters
[in]nameis the name of a new or existing item. Names are unique,
[in]typeis type of new cloud
Returns
pointer to new item

References UPcpItem::clear(), UPcpItem::getCloudType(), UPcpItem::getPointsCnt(), ULock::lock(), UPcpItem::makeCloud(), UPcpItem::setAsPolyline(), UPcpItem::setName(), UPcpItem::setUpdated(), ULock::unlock(), and UPcpItem::UPcpItem().

bool UResPcp::codePcpXml ( const char *  tagName,
char *  buf,
const int  bufCnt,
int  idx 
)

code all pcpgons to an XML message into this buffer

Parameters
tagNameis the name to the tag, in wich the pcpgons are to be listed.
buffis the buffer, where to write the code.
buffCntis the size of the buffer
updatedSinceonly items updated later than this is XML packed
Returns
a pointer to buff code one pcp to an XML message into this buffer
Parameters
tagNameis the name to the tag, in wich the pcpgons are to be listed.
buffis the buffer, where to write the code.
buffCntis the size of the buffer
updatedSinceonly items updated later than this is XML packed
idxis index to the pcpgon to code.
Returns
true if the update time is later than updatedSince (else not coded)

References buf, and UPcpItem::codeXML().

Referenced by getPolysCnt(), and UFuncPcp::handleCommand().

virtual const char* UResPcp::commandList ( )
inlinevirtual

Function, that shall return a string with all handled XML tags, i.e. should return "gmk gmk2d guidemark", if incoming XML tags starting with any of these three keywords are handled by this function

Reimplemented from UClientFuncBase.

References createResources(), getItem(), getItemXYZ(), handleNewData(), methodCall(), methodCallV(), UClientFuncBase::name(), and print().

UPcpItem* UResPcp::copy ( pcl::PointCloud< pcl::PointXYZ > *  source,
const char *  name 
)
inline

make a new cloud (XYZRGB) for this source

Parameters
sourceis the source cloud to copy
nameis the name of the new item. The name must be unique,
Returns
a pointer to the new item, or null if it exist already, or could not be added.

References add(), UPcpItem::copy(), getItem(), and UPcpItem::PointXyz.

UPcpItem* UResPcp::copy ( pcl::PointCloud< pcl::PointXYZRGB > *  source,
const char *  name 
)

make a new cloud (XYZRGB) for this source

Parameters
sourceis the source cloud to copy
nameis the name of the new item. The name must be unique,
Returns
a pointer to the new item, or null if it exist already, or could not be added.
void UResPcp::createBaseVar ( )
protected

Make the variables that will be available to other plugins

Referenced by savePCD().

void UResPcp::createResources ( )
virtual

Create any resources that this modules needs This method is called after the resource is registred by the server.

Reimplemented from UResBase.

Referenced by commandList().

bool UResPcp::del ( const char *  name)

Delete a pcp, that is, set vertex count to 0 This marks that the pcpgon is empty and the pcpgon slot may be reused.

Parameters
nameis the name of the pcp
Returns
true if deleted pcp, false if not existed.

References UPcpItem::clear(), ULock::lock(), and ULock::unlock().

Referenced by getItem(), and UFuncPcp::handleCommand().

UPcpItem * UResPcp::getItem ( const char *  name)

Get pcp item pointer

Parameters
nameis the name of the pcp
Returns
NULL if a pcp with this name is not found

Referenced by commandList(), copy(), UFuncPcp::handleCommand(), and savePCD().

UPcpItem* UResPcp::getItem ( int  idx)
inline

get an item by index, NB no range check

Parameters
idxthe index to the items available, should be in the range 0..getPolysCnt()-1.
Returns
a pointer to the iten, NB! the pointer may be NULL

References add(), del(), getNext(), and pcps.

UPcpItem * UResPcp::getItemXYZ ( const char *  name)

Get pcp item pointer

Parameters
nameis the name of the pcp
Returns
a pointer to an existing or if not found, a pointer to an empty item of this name

References UPcpItem::add(), UPcpItem::makeCloud(), UPcpItem::PointXyz, and UPcpItem::setName().

Referenced by commandList().

const char * UResPcp::getList ( const char *  preStr,
char *  buff,
const int  buffCnt 
)

Get list of current pcps

Parameters
preStris a short string, that is added at the start of the buffer.
buffis the buffer, where to write the list.
buffCntis the size of the buffer
Returns
a pointer to buff

Referenced by getPolysCnt(), and UFuncPcp::handleCommand().

UPcpItem * UResPcp::getNext ( int  p1,
int *  p2,
const char *  name 
)

Get pcp item pointer starting at index 'p1'

Parameters
p1is the first pcpgon to search for the next name that matches 'name'
p2is set (if not NULL) to the next pcpgon after the found
nameis the name of the pcp
Returns
NULL if a pcp with this name is not found

References UPcpItem::isA(), and UPcpItem::match().

Referenced by getItem().

int UResPcp::getPolysCnt ( )
inline

Get number of current pcp processes

Returns
number of pcps, active or not

References buf, codePcpXml(), getList(), gotNewData(), and pcpsCnt.

Referenced by UFuncPcp::handleCommand().

void UResPcp::gotNewData ( )

Tell a display plugin that new data exist - for a potential redraw.

Referenced by getPolysCnt(), and UFuncPcp::handleCommand().

void UResPcp::handleNewData ( USmlTag tag,
const char *  ifname 
)
virtual
bool UResPcp::methodCall ( const char *  name,
const char *  paramOrder,
char **  strings,
const double *  pars,
double *  value,
UDataBase **  returnStruct,
int *  returnStructCnt 
)
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 UPcpItem::add(), UPosition::clear(), UPcpItem::getPoint(), UPcpItem::getPointsCnt(), UPcpItem::isA(), roundi(), and UVariable::set3D().

Referenced by commandList().

bool UResPcp::methodCallV ( const char *  name,
const char *  paramOrder,
UVariable params[],
UDataBase **  returnStruct = NULL,
int *  returnStructCnt = NULL 
)
virtual

A varPool method with this class as implementor is called.

Parameters
nameis the name of the called function
paramOrderis a string with one char for each parameter in the call - d is double, s is string, c is class object.
paramsis an array of variable pointers with the actual parameters, in the order specified by order
returnStructis an array of class object pointers that can return values or objects (may be NULL) if no result value is needed (a procedure call)
returnStructCntis the number of objects in the returnStruct buffer
Returns
true if the method is recognised (exists), when false is returned a invalid name or parameter list is detected.

Reimplemented from UVarMethodImplement.

References UPcpItem::add(), UPosition::clear(), UPcpItem::cooSys, UPcpItem::copy(), UVariable::get3D(), UVariable::getInt(), UPcpItem::getPoint(), UPcpItem::getPointsCnt(), UPcpItem::isA(), UDataBase::isAlsoA(), UPcpItem::makeCloud(), UPcpItem::PointXyz, UPcpItem::PointXyzRgb, UPcpItem::remove(), roundi(), UVariable::set3D(), UPcpItem::setAsPolygon(), UPcpItem::setAsPolyline(), UVariable::setBool(), UPcpItem::setUpdated(), UPosition::x, UPosition::y, and UPosition::z.

Referenced by commandList().

const char * UResPcp::print ( const char *  preString,
char *  buff,
int  buffCnt 
)
virtual

print status to a string buffer

Reimplemented from UResVarPool.

Referenced by commandList().

bool UResPcp::savePCD ( const char *  idName,
const char *  filename 
)
inline

Save a cloud to a pcd-file

References createBaseVar(), getItem(), and UPcpItem::savePCD().

Referenced by UFuncPcp::handleCommand().

void UResPcp::UResPcpInit ( )

Initialize resource

Referenced by UResPcp().

Member Data Documentation

const int UResPcp::MAX_POLYS_CNT = 1000
staticprotected

maximum number of pcps

UPcpItem* UResPcp::pcps[MAX_POLYS_CNT]
protected

array of pcp handles

Referenced by getItem().

int UResPcp::pcpsCnt
protected

Number of pcps allocated.

Referenced by getPolysCnt().

UVariable* UResPcp::varCallDispOnNewData
protected

inform a potential display plugin, that new data is available

UVariable* UResPcp::varPolyCnt
protected

number of established pcp items

UVariable* UResPcp::varUpdTime
protected

last update time for pcpgons

bool UResPcp::verbose

Is the resource to output verbose message to console

Referenced by UFuncPcp::handleCommand().


The documentation for this class was generated from the following files: