AURobotServers  4
Public Types | Public Member Functions | Static Public Member Functions | Public Attributes | Protected Member Functions | Protected Attributes | Private Attributes | List of all members
UVariable Class Reference

#include <uvariable.h>

Inheritance diagram for UVariable:
Inheritance graph

Public Types

enum  varType {
  none, d, s, d3d,
  d2d, d6d, dq, t,
  pose, rot, m2, i,
  b
}
 

Public Member Functions

double add (double value, int idx=0, UTime *updTime=NULL)
 
int cols ()
 
void copy (const UVariable *source, bool alsoName)
 
bool descriptionBufferUsed () const
 
UPosition get3D () const
 
UPosRot get6D () const
 
bool getBool (const int idx=0)
 
int getByteCnt () const
 
virtual const char * getDataType ()
 
double getDouble (const int idx=0)
 
int getElementCnt () const
 
virtual int getElementCnt2 () const
 
float getFloat (const int idx=0)
 
const char * getGetAsXmlAttribute (char *buff, const int buffCnt)
 
int getInt (const int idx=0)
 
bool getM (matrix *mat)
 
bool getM (UMatrix *mat)
 
UVarPoolgetParent ()
 
UPose getPose () const
 
UPoseTime getPoseTime () const
 
URotation getRot () const
 
int getSize ()
 
const char * getString (const int idx=0) const
 
UTime getTime (const int idx=0)
 
UVariable::varType getType () const
 
const char * getTypeChar (char *to, const int toCnt)
 
bool getValueBool (const int idx=0)
 
const char * getValueBuffer () const
 
double getValued (const int idx)
 
double getValued () const
 
const char * getValuedAsString (int idx, const char *preStr, char *buff, const int buffCnt, int histIdx=0)
 
int getValueInt (const int idx=0)
 
const char * getValues (const int idx=0) const
 
const char * getValuesAsString (char *buff, const int buffCnt, int histIdx)
 
const char * getValuesAsStringQuoted (char *buff, const int buffCnt, int histIdx)
 
double * getValuesd ()
 
const char * getValuesdAsString (char *buff, const int buffCnt, int histIdx)
 
const char * getValuesmAsString (char *buff, const int buffCnt)
 
const char * getValuesmAsStringLimited (char *buff, const int buffCnt, int maxRows, int maxCols)
 
void inverse ()
 inverse - element by element inverse all values one by one, i.e. a = 1.0/a. if |a| < 1e-100, then a is set to +1e100 Works on double based variables only. More...
 
virtual bool isAlsoA (const char *typeString)
 
bool isDouble () const
 
bool isString () const
 
bool isTypeA (const varType testType)
 
bool makeTimeSeries (int histCnt, double maxUpdateRate)
 
void negate ()
 negate - element by element Negate value of this variable, i.e. change sign of all values. Works on double based variables only. More...
 
bool openVarLog (bool logFileOpen)
 
int rows ()
 
void saveToLog (ULogFile *logFile, const char *prename, ULock *fileLock)
 
bool set3D (UPosition *value, UTime *updT=NULL)
 
bool set6D (UPosRot *value, UTime *updT=NULL)
 
bool setAll (double value)
 
bool setBinaryAnd (UVariable *left, UVariable *right)
 element by element binary AND values Make this variable an array of same size as left and right, with the values: this[i]= long(left[i]) & long(right[i]) More...
 
bool setBinaryOr (UVariable *left, UVariable *right)
 element by element binary OR values Make this variable an array of same size as left and right, with the values: this[i]= long(left[i]) & long(right[i]) More...
 
bool setBinaryShiftLeft (UVariable *left, UVariable *right)
 element by element bit shift left Make this variable an array of same size as left,and shift based on first element of right with the values: this[i]= double(long(left[i]) << long(right[0])) More...
 
bool setBinaryShiftRight (UVariable *left, UVariable *right)
 element by element bit shift right Make this variable an array of same size as left,and shift based on first element of right with the values: this[i]= double(long(left[i]) << long(right[0])) More...
 
bool setBinaryXor (UVariable *left, UVariable *right)
 element by element binary XOR values Make this variable an array of same size as left and right, with the values: this[i]= long(left[i]) ^ long(right[i]) More...
 
bool setBool (bool value, const int idx=0, bool mayAdd=false, UTime *updT=NULL)
 
const char * setDescription (const char *desc, bool makeCopy)
 
bool setDiff (UVariable *left, UVariable *right)
 element by element difference of values Make this variable an array of same size as left and right, with the values: this[i]= left[i] - right[i] More...
 
bool setDivide (UVariable *left, UVariable *right)
 element by element division of values Make this variable an array of same size as left and right, with the values: this[i]= left[i] / right[i] More...
 
bool setDouble (double value, const int idx=0, bool mayAdd=false, UTime *updT=NULL)
 
bool setDouble (double *values, const int valuesCnt, UTime *updT=NULL)
 
bool setEq (UVariable *left, UVariable *right)
 Equal Sets the value of this variable (size 1) to 1 if all the elements in left is (exactly) equal to the one on the right. The left and right size must be equal. Else the value is 0. More...
 
bool setGe (UVariable *left, UVariable *right)
 Greater or equal- element by element Make this variable an array of same size as left and right, with the values this[i]=1.0 if left[i] is >= right[i], else 0.0. More...
 
bool setGt (UVariable *left, UVariable *right)
 Greater than - element by element Make this variable an array of same size as left and right, with the values this[i]=1.0 if left[i] is > right[i], else 0.0. More...
 
bool setInt (int value, const int idx=0, bool mayAdd=false, UTime *updT=NULL)
 
bool setLe (UVariable *left, UVariable *right)
 Less than or equal - element by element Make this variable an array of same size as left and right, with the values this[i]=1.0 if left[i] is <= right[i], else 0.0. More...
 
bool setLogicalAnd (UVariable *left, UVariable *right)
 element by element logical And values Make this variable an array of same size as left and right, with the values: this[i]= left[i] and right[i] More...
 
bool setLogicalOr (UVariable *left, UVariable *right)
 element by element logical OR values Make this variable an array of same size as left and right, with the values: this[i]= left[i] or right[i] More...
 
bool setLt (UVariable *left, UVariable *right)
 Less than - element by element Make this variable an array of same size as left and right, with the values this[i]=1.0 if left[i] is < right[i], else 0.0. More...
 
bool setModulo (UVariable *left, UVariable *right)
 element by element modulo operation Make this variable an array of same size as left,and operate based on first element of right with the values: this[i]= double(long(left[i]) % long(right[0])) More...
 
void setName (const char *newName, int *idx=NULL)
 
bool setNe (UVariable *left, UVariable *right)
 Not equal Sets the value of this variable (size 1) to 1 if one or more of the elements in left is not (exactly) equal to the one on the right. The left and right size must be equal. Else the value is 0. More...
 
bool setNot ()
 set all element to the negated value of the current value. More...
 
void setParent (UVarPool *value)
 
bool setPlus (UVariable *left, UVariable *right)
 element by element sum of values Make this variable an array of same size as left and right, with the values: this[i]= left[i] + right[i] More...
 
bool setPose (UPose *value, UTime *updT=NULL)
 
bool setPose (UPoseTime *value, UTime *updT=NULL)
 
bool setPow (UVariable *left, UVariable *right)
 element by element power operation Make this variable an array of same size as left,and operate based on first element of right with the values: this[i]= pow(left[i], right[0]) More...
 
bool setProduct (UVariable *left, UVariable *right)
 element by element product of values Make this variable an array of same size as left and right, with the values: this[i]= left[i] * right[i] More...
 
bool setRot (URotation *value, UTime *updT=NULL)
 
int setSize (int rows, int cols)
 
int setSize (int elements)
 
bool setString (const char *attValue, const int idx, bool mayAdd, UTime *updT=NULL)
 
bool setTime (UTime t, const int idx=0)
 
bool setTimeNow (const int idx=0)
 
bool setType (varType newType)
 
bool setTypeChar (const char *to)
 
bool setUnit ()
 
bool setValue (const UVariable *source, const int idx, UTime *updT=NULL)
 
bool setValued (double value, const int ix=0, bool mayAdd=false, UTime *updT=NULL)
 
bool setValued (const char *attValue, const int idx, bool mayAdd, UTime *updT=NULL)
 
bool setValueM (UMatrix *mat, UTime *updT=NULL)
 
bool setValueM (matrix *mat, UTime *updT=NULL)
 
bool setValueM (int rCnt, int cCnt, double *values, UTime *updT=NULL)
 
bool setValueNew (const char *newName, const char *attValue, const char *type, const char *comment)
 
bool setValues (const char *attValue, const int idx, bool mayAdd, UTime *updT=NULL)
 
virtual void snprint (const char *preString, char *buff, const int buffCnt)
 
void updateQtTest (float holdTime)
 
 UVariable ()
 
 UVariable (UVariable *source)
 
virtual ~UVariable ()
 
- Public Member Functions inherited from UDataBase
bool isA (const char *typeString)
 
 UDataBase ()
 
virtual ~UDataBase ()
 
- Public Member Functions inherited from UVarLog
void changed (double *data, bool isDouble=true, UTime *updTime=NULL)
 
int getHistoryRows ()
 
const char * getLogFilename ()
 
int getMeanMinMax (int element, UTime toTime, double *mean, double *min, double *max, int sampleInterval=1)
 
UMatrixgetTimeSeries (UMatrix *buffer, int maxRows)
 
int getTimeVector (double *buffer, int bufferCnt, int element)
 
UTime getUpdTime ()
 
int getVectorToTime (double *buffer, int bufferCnt, int element, UTime tot, int interval, double *gotdt)
 
bool hasHist () const
 
bool makeHist (int histCnt, int elementCnt, double maxUpdateRate)
 
bool openLog (bool doOpen, const char *preName=NULL, const char *varName=NULL)
 
bool setMaxUpdateRate (double maxUpdateRate)
 
bool setReplay (bool doOpen, const char *preName, const char *varName, UReplay *replayParent)
 
 UVarLog ()
 
virtual ~UVarLog ()
 

Static Public Member Functions

static bool splitNameIndex (const char *nameWithIndex, int *index, int *col, int *nameLng)
 
static varType typeFromChar (const char *typ)
 

Public Attributes

const char * description
 
char name [MAX_VAR_NAME_SIZE+1]
 
- Public Attributes inherited from UVarLog
UVarHisthist
 

Protected Member Functions

virtual bool decodeReplayLine (char *line)
 
void setUpdated (UTime *updTime=NULL)
 

Protected Attributes

int byteCnt
 
varType dataType
 
double * dValue
 
int elementCnt
 
int elementSize
 
bool isDoubleBased
 
UVarPoolparent
 
UTime updTimeLast
 
UTime updTimeNewest
 

Private Attributes

char * descriptionBuffer
 

Detailed Description

A variable for the calculator

Member Enumeration Documentation

defined types of variables (d=double i=integer, b=boolean, t=time, s=string) all except string is double based (double or double array)

Enumerator
none 
d3d 
d2d 
d6d 
dq 
pose 
rot 
m2 

Constructor & Destructor Documentation

UVariable::UVariable ( )
UVariable::UVariable ( UVariable source)

Copy constructior

References byteCnt, copy(), descriptionBuffer, dValue, elementCnt, and parent.

UVariable::~UVariable ( )
virtual

Destructor

References byteCnt, description, descriptionBuffer, dValue, and elementCnt.

Member Function Documentation

double UVariable::add ( double  value,
int  idx = 0,
UTime updTime = NULL 
)
int UVariable::cols ( )

Get number of rows for this variable.

Returns
returns number of elements in variable, or in each row if a matrix.

References dataType, dValue, elementCnt, m2, and roundi().

Referenced by getParent(), getValuesdAsString(), getValuesmAsStringLimited(), UFunctionVarPool::sendVar(), UFunctionVarPool::sendVarList(), setName(), setSize(), setUnit(), and testVar().

void UVariable::copy ( const UVariable source,
bool  alsoName 
)
bool UVariable::decodeReplayLine ( char *  line)
protectedvirtual

Decode this replay line, that is assumed to be valid.

Parameters
lineis a pointer to the line.
Returns
true if the line is valid and used (step is successfull).
false if line is not a valid step.

Reimplemented from UVarLog.

References dValue, elementCnt, isDoubleBased, UTime::setTimeU(), setUpdated(), t, and UTime::valid.

Referenced by descriptionBufferUsed().

bool UVariable::descriptionBufferUsed ( ) const
inline

Is the description buffer used

References decodeReplayLine(), description, descriptionBuffer, setAll(), setUnit(), setUpdated(), and updateQtTest().

Referenced by copy().

UPosition UVariable::get3D ( ) const
UPosRot UVariable::get6D ( ) const
bool UVariable::getBool ( const int  idx = 0)
inline

Get boolean type value of this variable

Parameters
idxvariable may be an array, so an index is provided
Returns
the value as boolean

References getInt(), getTime(), getValueBool(), and setValued().

Referenced by UFuncPCLTest::CalcMapFromCloud(), UFuncKinect::callGotNewDataWithObject(), UResAvoid::copyAvoidObstacles(), UResAvoid::copyCellPolys(), UResAvoid::copyFootprintPolys(), UResPassable::doFullAnalysis(), UResLocater::doLocatorUpdates(), UResPassable::doObstAnalysis(), UFuncPpl::drawPolygons(), UImgPush::fillBuffer(), UImgPush::fillShowBuffer(), UResAvoid::findPathToHere(), UImagePool::getImage(), UResKeep::getKeepList(), UFakeDevice::getNewestData(), UResObstacle::getObstacleGroupSettings(), UResObstacle::getOutdoorExtraDist(), UResAuEf::getParams(), UResPassable::getSettingsFromVarPool(), UFuncKinect::GetXYZCoordinates(), UResCamIfCam::gotNewData(), UFuncPlan::handleAddCon(), UFuncPlan::handleAddPoint(), UFuncImu::handleCommand(), UFuncRadar::handleCommand(), UFuncPlan::handleFindRoute(), UFuncPlan::handleGetPoint(), UFunctionCamGmk::handleGmkGetCommand(), UFuncKinect::handleKinect(), UFuncPiCam::handleNormal(), UResLaserIfObst::handleObst(), UResIfVar::handlePoseHist(), UFuncPTgrey::handlePTgrey(), UFuncPlan::handleResetPlan(), UFuncStereo::handleStereo(), UResIfVar::handleVar(), UImgPush::imgUpdated(), UFuncStereo::initializeStereo(), UResIf::interfaceTick(), UResRhdIf::isConnected(), UCamDevBase::isLog(), UResObstacle::isOutdoorContext(), UCamDevBase::isReplay(), UResRhdIf::isWriteGranted(), UResRhdIf::isWriteRequested(), UResLocater::locate(), UResLobst::makeObst(), UMisRuleState::methodCall(), UFunctionPassable::polygonToPolyPlugin(), UResLocater::polygonToPolyPlugin(), UFuncStraightLine::polygonToPolyPlugin(), UKeepItem::print(), UFuncKinect::processDepthImages(), UFuncStereo::processImages(), UResIf::quitRemoteEnd(), UResLocater::rowEndDetect(), UFuncImu::run(), UFuncView::run(), UResRhdIf::run(), UFuncPiCam::run(), UFuncKinect::run(), UFuncRadar::run(), UResKeep::run(), UFuncRadar::runRead(), UFuncPTgrey::runSetting(), UResLobst::sendAsObstacles(), UResSmrCtl::sendNewManoeuvreToSMR(), UFuncLaserBox::sendToPolyPlugin(), UResLocater::set_state(), UResLocater::set_utmstate(), UImgPush::setTcpPort(), UResLocater::setUtmPoseToMapPose(), UResSmrCtl::start(), UResSmrCtl::startPoseStreaming(), startUFuncTOFThreadData(), UKeepItem::tick(), UResRhdIf::tryConnect(), UFuncKinect::updateCloud(), UResPoseHist::updateVarPool(), UResAvoid::useRev2(), and UFuncKinect::~UFuncKinect().

int UVariable::getByteCnt ( ) const
inline

Get byte size of buffer

References byteCnt.

Referenced by copy().

virtual const char* UVariable::getDataType ( )
inlinevirtual

Get (end) type of this structure

Reimplemented from UDataBase.

References isAlsoA(), and snprint().

Referenced by isAlsoA().

double UVariable::getDouble ( const int  idx = 0)
inline
int UVariable::getElementCnt ( ) const
inline
virtual int UVariable::getElementCnt2 ( ) const
inlinevirtual

Get number of elements as getElementCnt() (used virtually from time series subclass)

Reimplemented from UVarLog.

References elementCnt.

float UVariable::getFloat ( const int  idx = 0)
inline

Supplementary call

Parameters
idxvariable may be an array, default is 0
Returns
the value as float

References getValued().

const char * UVariable::getGetAsXmlAttribute ( char *  buff,
const int  buffCnt 
)

make an attribute string from the name and value of this variable

Parameters
buffis the string buffer to hold the result
buffCntis the length of the buffer
Returns
a pointer to the buffer

References elementCnt, getValuedAsString(), i, and name.

Referenced by getType(), and setValued().

int UVariable::getInt ( const int  idx = 0)

Get integer type value of this variable

Parameters
idxvariable may be an array, so an index is provided
Returns
the value as int

References d, getValued(), and roundi().

Referenced by UFuncKinect::callGotNewDataWithObject(), UResAvoid::copyCellPolys(), UFuncKinect::decodeReplayLine(), UFuncFz::doClassify(), UNamedBoxes::doDetect(), UFuncImSeg::doGrayLevelCooccurenceMatrix(), UFuncImSeg::doLBPhistogramMatch(), UFuncBallKL::filterMask(), UFuncPiPi::filterMask(), UFuncCropRow::filterMask(), UFuncBall::filterMask(), UFuncBall_improved::filterMask(), UFuncLinefinder::filterMask(), UFuncBallKL::findBall(), UFuncPiPi::findBall(), UFuncBall::findBall(), UFuncBall_improved::findBall(), UFuncBallKL::findBallCandidates(), UFuncPiPi::findBallCandidates(), UFuncBall::findBallCandidates(), UFuncBall_improved::findBallCandidates(), UFuncImSeg::findBestCoooccurrence(), UResAvoid::findPathToHere(), UFuncCropRow::findPlants(), UFuncImSeg::findSegments(), UFuncTracking::FirstImage(), getBool(), UResObstacle::getFixedObstCnt(), UImagePool::getImage(), UResAuEf::getParams(), UResRhdIf::getPort(), UResPassable::getSettingsFromVarPool(), UImgPush::getTcpPort(), UFuncKinect::GetXYZCoordinates(), UResCamIfImg::gotNewImage(), UFuncBall_improved::handleCommand(), UFuncBallKL::handleCommand(), UFuncPiPi::handleCommand(), UFuncCropRow::handleCommand(), UFuncPpl::handleCommand(), UFuncStraightLine::handleCommand(), UFuncLinefinder::handleCommand(), UFuncV4lGst::handleCommand(), UFuncFz::handleCommand(), UFuncLaserBox::handleCommand(), UFunctionCamGmk::handleGmkGetCommand(), UFuncImgPoly::handleImgPolyCommand(), UFuncKinect::handleKinect(), UFuncLoca2::handleLocalize(), UFuncPiCam::handleNormal(), UFuncPTgrey::handlePTgrey(), UFuncStereo::handleStereo(), UFuncLinefinder::houghTest(), UImgPush::imgUpdated(), UFuncFz::initializeClassesFromLine(), UFuncStereo::initializeStereo(), UResIf::interfaceTick(), UFuncFz::loadNewImage(), UFuncPiCam::logFileTest(), UFuncKinect::logFileTest(), UFuncPiCam::logImageToFile(), UFuncPTgrey::logImageToFile(), UFuncKinect::logImageToFile(), UFuncTOF::logImageToFile(), UFuncImSeg::makeLBPimage(), UFuncPCLTest::MakeMap(), UFuncKinect::makeObj3Dcloud(), UResLobst::makeObst(), UFuncBallKL::maskColors(), UFuncPiPi::maskColors(), UFuncBall::maskColors(), UFuncBall_improved::maskColors(), UFuncLinefinder::maskColors(), UFuncImSeg::meanShiftSegment(), UFuncKinect::methodCall(), UResPcp::methodCallV(), UResPoly::methodCallV(), UResIf::openConnection(), UKeepItem::print(), UFuncTOF::processChannel8(), UFuncKinect::processDepthImages(), UFuncStereo::processImages(), UFuncTOF::processImages(), UResLocater::quality(), UFuncPTgrey::Receiver(), UFuncImu::run(), UFuncView::run(), UResRhdIf::run(), UImgPush::run(), UFuncPiCam::run(), UFuncKinect::run(), UFuncRadar::run(), UFuncV4lGst::run(), UFuncPiCam::runAlive(), UFuncPTgrey::runSetting(), UFuncTOF::runSetting(), UResLaserIfScan::snprint(), startUFuncTOFThreadData(), UCmdExe::sysModuleCmd(), UFuncTracking::TrackObjects(), UResRhdIf::tryConnect(), UFuncKinect::updateCloud(), UFuncV4lGst::useBuffer(), and UCamDevGuppy::~UCamDevGuppy().

bool UVariable::getM ( matrix *  mat)

Get values to a matrix structure.
The mat matrix must be initialized, and the size of the matrix will not be changed. If the size of this matrix do not match mat, then no data is loaded into mat, and function returns false.

Parameters
matis a IAU matrix, where the result will be placed.
Returns
true if the size match (and data is loaded to mat).
false if matrix size do not match

References dataType, dValue, m2, and roundi().

Referenced by getValuesd().

bool UVariable::getM ( UMatrix mat)

Get values to a matrix structure.
The mat matrix must be initialized, and the size of the matrix will not be changed. If the size of this matrix do not match mat, then no data is loaded into mat, and function returns false.

Parameters
matis a openCV matrix (packed into the UMatrix class), where the result will be placed.
Returns
true if the size match (and data is loaded to mat).
false if matrix size do not match

References UMatrix::cols(), dataType, dValue, m2, roundi(), UMatrix::rows(), and UMatrix::setMat().

UVarPool* UVariable::getParent ( )
inline

Get the parent var pool - e.g. to get fully qualified variable name

Returns
pointer to the parent var-pool, is NULL if no parent

References cols(), getSize(), parent, rows(), and setSize().

Referenced by UQtgui::updVarEvent(), and UQStandardItem::UQStandardItem().

UPose UVariable::getPose ( ) const
UPoseTime UVariable::getPoseTime ( ) const

Get first 3 values in a UPose structure

References dValue, elementCnt, UPose::set(), and UPoseTime::setPt().

Referenced by getValues().

URotation UVariable::getRot ( ) const

Get first 3 values in a URotation structure

References dValue, elementCnt, and URotation::set().

Referenced by UVarPool::getLocalValueRot(), and getValues().

int UVariable::getSize ( )
Returns
number of elements in this variable. NB! size returned for a matrix is rows*cols, but actually data element is 2 values larger to store rows and cols)

References dataType, elementCnt, and m2.

Referenced by getParent(), UFunctionVarPool::sendVar(), and setSize().

const char* UVariable::getString ( const int  idx = 0) const
inline

Get pointer to value of this variable (assuming it is a string).

Parameters
idx=0index to possible starting position of returned string
Returns
a pointer to the value buffer (starting at position idx)

References getValues().

Referenced by UTermEmulator::addIfButtons(), UNamedBoxes::findNamedBox(), UVarPool::getGlobalString(), UFuncV4lGst::handleCommand(), UFuncLaserBox::handleCommand(), UResIf::openConnection(), UImgPush::run(), UFuncRadar::run(), and UFuncV4lGst::run().

UTime UVariable::getTime ( const int  idx = 0)

Get UTime type value from this variable

Parameters
idxvariable may be an array, so an index is provided
Returns
the value as UTime

References d, getValued(), and UTime::setTime().

Referenced by UFuncKinect::callGotNewDataWithObject(), getBool(), UResAvoid::getCalcTime(), UResAuEf::getLastUpdateTime(), UResCamIfCam::snprint(), and UResCamIfImg::snprint().

UVariable::varType UVariable::getType ( ) const
inline

Get data type as a character string to this buffer

Parameters
toa character buffer to store result
toCntthe size of the buffer
Returns
a pointer to the buffer

References add(), dataType, getGetAsXmlAttribute(), getValuedAsString(), getValuesAsString(), getValuesAsStringQuoted(), getValuesdAsString(), getValuesmAsString(), getValuesmAsStringLimited(), setName(), setTypeChar(), splitNameIndex(), and typeFromChar().

Referenced by copy(), and UFunctionVarPool::sendVar().

const char * UVariable::getTypeChar ( char *  to,
const int  toCnt 
)

Get data type as a character string to this buffer

Parameters
toa character buffer to store result
toCntthe size of the buffer
Returns
a pointer to the buffer

References b, d, d2d, d3d, d6d, dataType, dq, i, m2, pose, rot, s, and t.

Referenced by isString(), saveToLog(), and UFunctionVarPool::sendVar().

bool UVariable::getValueBool ( const int  idx = 0)

Get boolean type value of this variable

Parameters
idxvariable may be an array, so an index is provided
Returns
the value as boolean

References getValued(), and isDouble().

Referenced by UTermEmulator::addIfButtons(), UResPoseHist::addIfNeeded(), getBool(), getValueInt(), UKeepItem::isWait(), UResCamIfGmk::newDataAvailable(), and UCmdExe::run().

const char* UVariable::getValueBuffer ( ) const
inline

Get the base of the variables in this variable.

Returns
a pointer to the value buffer

References dValue.

Referenced by copy(), getValuesAsString(), UVarMethod::methodCallV(), and setValue().

double UVariable::getValued ( const int  idx)

Get double type value of this variable

Parameters
idxvariable may be an array, so an index is provided
Returns
the value as double

References dataType, dValue, elementCnt, isDouble(), and m2.

Referenced by UResAvoid::copyCellPolys(), UFuncLoca2::correlateLines(), UResPassable::doFullAnalysis(), UResLocater::doLocatorUpdates(), UResPassable::doObstAnalysis(), UResDrivePos::driveOdo(), UResRoadDrive::driveSide(), UMisLoop::evalCondition(), UMisControl::evaluateCondition(), UMisCaseSwitch::evaluateExpr(), UVarCalc::evaluateUnaryValV(), UMisAssign::execute(), UMisIf::execute(), UMisControl::execute(), UFuncBallKL::findBall(), UFuncBall::findBall(), UFuncBall_improved::findBall(), UResAvoid::findPathToHere(), UResRoseBot::findRows(), UResSmrIf::getAcc(), UFuncBall::getBallSize(), UFuncBall_improved::getBallSize(), UVarPool::getGlobalValue(), UVarPool::getLocalValue(), UVarPool::getLocalValueBool(), UResPoseHist::getMinDist(), UResPoseHist::getMinTheta(), UResPoseHist::getMinTime(), UResSmrIf::getMinTurnRad(), UResMapObst::getNearObstacles(), UResObstacle::getObstacleGroupSettings(), UResAuEf::getParams(), UResPassable::getSettingsFromVarPool(), UResSmrIf::getSpeed(), UResSmrIf::getTurnAcc(), UVarCalc::getValueAnyV(), UFuncBallKL::handleCommand(), UFuncRoseBot::handleCommand(), UFuncLocalize::handleLocalize(), UFuncLoca2::handleLocalize(), UFuncLocalize::handleLocalizeMHF(), UFuncLocalize::handleLocalizeUKF(), UFuncLocalize::handleSetInitCov(), UMisRuleState::initCall(), UResIf::interfaceTick(), UCamRad::lensParChanged(), UResLobst::makeObst(), UResLocater::match_points(), UMisRuleState::methodCall(), UMisRuleState::methodCallV(), UResRuleState::methodCallV(), UResLaserIfObst::newDataAvailable(), UResCamIfGmk::newDataAvailable(), UResLaserIfSf::newDataAvailable(), UResLocater::odoPredict(), UKeepItem::print(), UResLocater::rowEndDetect(), UResSmrCtl::run(), UFuncKinect::run(), UFuncTOF::runSetting(), UResSmrCtl::sendNewManoeuvreToSMR(), UFunctionVarPool::sendVar(), setBinaryAnd(), setBinaryOr(), setBinaryShiftLeft(), setBinaryShiftRight(), setBinaryXor(), setDiff(), setDivide(), setEq(), setGe(), setGt(), setLe(), UVarPool::setLocalVar(), setLogicalAnd(), setLogicalOr(), setLt(), setModulo(), setNe(), setPlus(), setPow(), setProduct(), setValue(), UResCamIfCam::snprint(), UResCamIfImg::snprint(), UResLaserIfSf::snprint(), UMisRuleState::step(), UKeepItem::tick(), UCamRad::updateLensParams(), and UResPoseHist::updateVarPool().

double UVariable::getValued ( ) const
inline

Get double type value of this variable

Returns
the value as double of first element

References dValue.

Referenced by add(), getDouble(), getFloat(), getInt(), getTime(), getValueBool(), getValueInt(), getValuesmAsStringLimited(), and isTypeA().

const char * UVariable::getValuedAsString ( int  idx,
const char *  preStr,
char *  buff,
const int  buffCnt,
int  histIdx = 0 
)

Get value (double type) as string - for data transfer

Parameters
idxis the index if variable is an array
preStris optional characters to put in front of value string, e.g. a space
buffis the buffer for the result
buffCntis the length of the provided buffer
Returns
a pointer to the buffer

References d, dataType, dValue, UVarHist::getData(), UVarLog::hasHist(), UVarLog::hist, and m2.

Referenced by getGetAsXmlAttribute(), getType(), and getValuesdAsString().

int UVariable::getValueInt ( const int  idx = 0)
inline

Get integer type value of this variable

Parameters
idxvariable may be an array, so an index is provided
Returns
the value as integer

References getValueBool(), getValued(), and roundi().

Referenced by UKeepItem::tick().

const char* UVariable::getValues ( const int  idx = 0) const
inline
const char * UVariable::getValuesAsString ( char *  buff,
const int  buffCnt,
int  histIdx 
)

Get all values - string or double - to this string buffer

Parameters
buffis the buffer for the result
buffCntis the length of the provided buffer
histIdxis 0 if current value, else time series index
Returns
a pointer to the buffer

References getValueBuffer(), getValuesdAsString(), and isString().

Referenced by UVarCalc::evaluateToStringV(), getType(), getValuesAsStringQuoted(), UFunctionVarPool::handleVarValues(), UFunctionVarPool::sendVar(), UFunctionVarPool::sendVarList(), UQtgui::setStruct(), and UQtgui::updVarEvent().

const char * UVariable::getValuesAsStringQuoted ( char *  buff,
const int  buffCnt,
int  histIdx 
)

Get all values - string or double - to this string buffer and pack into quotations marks or apostrophs. If double based quotation marks are used, if string the first part of the string is searched, and if a quotation mark is found (before a apostroph), then string is packed in apostroph.

Parameters
buffis the buffer for the result
buffCntis the length of the provided buffer
Returns
a pointer to the buffer

References dValue, getValuesAsString(), and isString().

Referenced by getType(), saveToLog(), and UFunctionVarPool::sendVar().

double* UVariable::getValuesd ( )
inline

Get array of values as doubles

References dataType, dValue, getM(), m2, and openVarLog().

Referenced by UFuncStereo::initializeStereo(), and UCamRad::updateLensParams().

const char * UVariable::getValuesdAsString ( char *  buff,
const int  buffCnt,
int  histIdx 
)

Get all double values to this string buffer

Parameters
buffis the buffer for the result
buffCntis the length of the provided buffer
histIdxis 0 if current value, else time series index
Returns
a pointer to the buffer

References cols(), dataType, getValuedAsString(), i, isDouble(), m2, and rows().

Referenced by getType(), getValuesAsString(), UFunctionVarPool::sendVarList(), snprint(), and testVar().

const char * UVariable::getValuesmAsString ( char *  buff,
const int  buffCnt 
)

Get string with values of a matrix, where rows are on seperate lines, and values in g format

Parameters
buffis the buffer for the result
buffCntis the length of the provided buffer
Returns
a pointer to the buffer

References getValuesmAsStringLimited().

Referenced by getType().

const char * UVariable::getValuesmAsStringLimited ( char *  buff,
const int  buffCnt,
int  maxRows,
int  maxCols 
)

Get string with values of a matrix, where rows are on seperate lines, and values in g format Limit the number of raws and columns

Parameters
buffis the buffer for the result
buffCntis the length of the provided buffer
maxRowsis the max number of rows shown
maxColsis the maximum number of columns shown
Returns
a pointer to the buffer

References cols(), getValued(), i, isDouble(), mini(), and rows().

Referenced by getType(), getValuesmAsString(), and UFunctionVarPool::sendVarList().

void UVariable::inverse ( )

inverse - element by element inverse all values one by one, i.e. a = 1.0/a. if |a| < 1e-100, then a is set to +1e100 Works on double based variables only.

References dValue, elementCnt, i, and isDoubleBased.

Referenced by getValues(), and UVarCalcOper::inverseValue().

bool UVariable::isAlsoA ( const char *  typeString)
virtual

Function to test if the class or one of its ancestors is of a specific type

Reimplemented from UDataBase.

References getDataType(), and UDataBase::isAlsoA().

Referenced by getDataType().

bool UVariable::isDouble ( ) const
inline
bool UVariable::isString ( ) const
inline
bool UVariable::isTypeA ( const varType  testType)
inline

Test for variable type by a simple string compare. Returns true is exact match - is case sensitive)

References dataType, and getValued().

Referenced by UFunctionVarPool::handleVarValues(), and UFunctionVarPool::sendVarList().

bool UVariable::makeTimeSeries ( int  histCnt,
double  maxUpdateRate 
)
inline

Make time series history for this variable

Parameters
varCntis the size of the time series (number of entries) to be allocated for on-line history.
maxUpdateRatemaksimum update rate for the time series (in Hz) (must be > 1e-6 Hz)
Returns
true if seccessful.

References elementCnt, UVarLog::makeHist(), and setDescription().

Referenced by UFuncImu::createResources(), UFunctionVarPool::handleVarValues(), and UVarPool::setLocalVar().

void UVariable::negate ( )

negate - element by element Negate value of this variable, i.e. change sign of all values. Works on double based variables only.

References dValue, elementCnt, i, and isDoubleBased.

Referenced by UVarCalc::evaluateUnaryValV(), getValues(), and UVarCalcOper::negateValue().

bool UVariable::openVarLog ( bool  logFileOpen)

Open logfile for this variable.

Parameters
logFileOpenif true, then log is opened (with name of variable extended with '.log. if false, then log is closed. '
Returns
true if log is open.

References getElementCnt(), UVarPool::getFullPreName(), UVarLog::hist, isDoubleBased, name, UVarLog::openLog(), parent, UVarHist::rowMaxCnt, and UVarHist::setHistSize().

Referenced by getValuesd(), UFunctionVarPool::handleVar(), and testVar().

int UVariable::rows ( )

Get number of rows for this variable.

Returns
1 if not a matrix, else number of rows.

References dataType, dValue, m2, and roundi().

Referenced by getParent(), getValuesdAsString(), getValuesmAsStringLimited(), UFunctionVarPool::sendVar(), UFunctionVarPool::sendVarList(), setName(), setSize(), setUnit(), and testVar().

void UVariable::saveToLog ( ULogFile logFile,
const char *  prename,
ULock fileLock 
)
bool UVariable::set3D ( UPosition value,
UTime updT = NULL 
)
bool UVariable::set6D ( UPosRot value,
UTime updT = NULL 
)
bool UVariable::setAll ( double  value)

Set all elements in this (double based) variable to this value

Parameters
valuevalue to be set into all elements - typically 0.0 or 1.0.
Returns
true if a double based variable

References dataType, dValue, elementCnt, i, isDoubleBased, m2, and setUpdated().

Referenced by descriptionBufferUsed(), and UFunctionVarPool::handleVarValues().

bool UVariable::setBinaryAnd ( UVariable left,
UVariable right 
)

element by element binary AND values Make this variable an array of same size as left and right, with the values: this[i]= long(left[i]) & long(right[i])

Parameters
leftis left operator value
rightis right operator value
Returns
true if both are double based and has same number of values

References dValue, getElementCnt(), getValued(), i, isDouble(), and mini().

Referenced by UVarCalcOper::evaluateV(), and getValues().

bool UVariable::setBinaryOr ( UVariable left,
UVariable right 
)

element by element binary OR values Make this variable an array of same size as left and right, with the values: this[i]= long(left[i]) & long(right[i])

Parameters
leftis left operator value
rightis right operator value
Returns
true if both are double based and has same number of values

References dValue, getElementCnt(), getValued(), i, isDouble(), and mini().

Referenced by UVarCalcOper::evaluateV(), and getValues().

bool UVariable::setBinaryShiftLeft ( UVariable left,
UVariable right 
)

element by element bit shift left Make this variable an array of same size as left,and shift based on first element of right with the values: this[i]= double(long(left[i]) << long(right[0]))

Parameters
leftis left operator value
rightis right operator value
Returns
true if both are double based

References dValue, getElementCnt(), getValued(), i, isDouble(), and roundi().

Referenced by UVarCalcOper::evaluateV(), and getValues().

bool UVariable::setBinaryShiftRight ( UVariable left,
UVariable right 
)

element by element bit shift right Make this variable an array of same size as left,and shift based on first element of right with the values: this[i]= double(long(left[i]) << long(right[0]))

Parameters
leftis left operator value
rightis right operator value
Returns
true if both are double based

References dValue, getElementCnt(), getValued(), i, isDouble(), and roundi().

Referenced by UVarCalcOper::evaluateV(), and getValues().

bool UVariable::setBinaryXor ( UVariable left,
UVariable right 
)

element by element binary XOR values Make this variable an array of same size as left and right, with the values: this[i]= long(left[i]) ^ long(right[i])

Parameters
leftis left operator value
rightis right operator value
Returns
true if both are double based and has same number of values

References dValue, getElementCnt(), getValued(), i, isDouble(), and mini().

Referenced by UVarCalcOper::evaluateV(), and getValues().

bool UVariable::setBool ( bool  value,
const int  idx = 0,
bool  mayAdd = false,
UTime updT = NULL 
)
inline

Supplementary call to set single value

Parameters
valueis the value to be set for the index idx
idxvariable may be an array, default is 0.
mayAddif true and the index is higher than element cnt, then more space is allocated.
updTis an optional pointer to the update time (relevant for time series only)
Returns
true if set, returns false if index is negative or if datatype is not double based

References setValued(), and setValues().

Referenced by UFuncKinect::callGotNewDataWithObject(), UResIf::connectionHangUp(), UCamPool::createBaseVar(), UFunctionCamGmk::handleGmkGetCommand(), UFuncKinect::handleKinect(), UFuncPiCam::handleNormal(), UFuncPTgrey::handlePTgrey(), UResIf::interfaceTick(), UResPcp::methodCallV(), UResPoly::methodCallV(), UResCamIfPath::newDataAvailable(), UResCamIfGmk::newDataAvailable(), UFuncPTgrey::Receiver(), UFuncTOF::Receiver(), UFuncView::run(), UResRhdIf::run(), UImgPush::run(), UFuncPiCam::run(), UFuncRadar::run(), UFuncV4lGst::run(), UFuncRadar::runRead(), UFuncPTgrey::runSetting(), UImgPush::runShow(), UKeepItem::setAllowOff(), UResLaserIfObst::setLog(), UCamDevBase::setLog(), UImagePool::setLogImg(), UCamDevBase::setReplay(), UKeepItem::setWait(), UResKeep::setWait(), UResRhdIf::setWriteable(), UImagePool::showImagesAsDefault(), UImgPush::startShowing(), UImgPush::startStreaming(), startUFuncTOFThreadData(), UFuncRadar::stop(), UResRhdIf::tryConnect(), UCmdExe::updateLocalVar(), UFuncKinect::updateReplayStatus(), and UImagePool::updateReplayStatus().

const char * UVariable::setDescription ( const char *  desc,
bool  makeCopy 
)

Set description of a variable

Parameters
descis the description.
makeCopyif true, then space iss allocated for description, if false then the value is assumed to be stationary in the lifetime of the variable, i.e. the description pointer is set directly to the source

References description, and descriptionBuffer.

Referenced by copy(), UResIfVar::handleVar(), UFunctionVarPool::handleVarValues(), and makeTimeSeries().

bool UVariable::setDiff ( UVariable left,
UVariable right 
)

element by element difference of values Make this variable an array of same size as left and right, with the values: this[i]= left[i] - right[i]

Parameters
leftis left operator value
rightis right operator value
Returns
true if both are double based and has same number of values

References dValue, getElementCnt(), getValued(), i, isDouble(), and mini().

Referenced by UVarCalcOper::evaluateV(), and getValues().

bool UVariable::setDivide ( UVariable left,
UVariable right 
)

element by element division of values Make this variable an array of same size as left and right, with the values: this[i]= left[i] / right[i]

Parameters
leftis left operator value
rightis right operator value
Returns
true if both are double based and has same number of values

References dValue, getElementCnt(), getValued(), i, isDouble(), and mini().

Referenced by UVarCalcOper::evaluateV(), and getValues().

bool UVariable::setDouble ( double  value,
const int  idx = 0,
bool  mayAdd = false,
UTime updT = NULL 
)
inline
bool UVariable::setDouble ( double *  values,
const int  valuesCnt,
UTime updT = NULL 
)

Call to set a series of (double) values. If variable is too small to hold the data, then it is extended.

Parameters
valuesarray of doubles to be inserted into the variable
valuesCntnumber of values in array to set
updTis an optional pointer to the update time (relevant for time series only)
Returns
true if set, returns false if index is negative or if datatype is not double based

References dValue, elementCnt, elementSize, isDoubleBased, setUpdated(), and setValued().

bool UVariable::setEq ( UVariable left,
UVariable right 
)

Equal Sets the value of this variable (size 1) to 1 if all the elements in left is (exactly) equal to the one on the right. The left and right size must be equal. Else the value is 0.

Parameters
leftis left operator value
rightis right operator value
Returns
true if both are double based and has same number of values

References dValue, getElementCnt(), getValued(), i, isDouble(), and setSize().

Referenced by UVarCalcOper::evaluateV(), and getValues().

bool UVariable::setGe ( UVariable left,
UVariable right 
)

Greater or equal- element by element Make this variable an array of same size as left and right, with the values this[i]=1.0 if left[i] is >= right[i], else 0.0.

Parameters
leftis left operator value
rightis right operator value
Returns
true if both are double based and has same number of values

References dValue, getElementCnt(), getValued(), i, isDouble(), and mini().

Referenced by UVarCalcOper::evaluateV(), and getValues().

bool UVariable::setGt ( UVariable left,
UVariable right 
)

Greater than - element by element Make this variable an array of same size as left and right, with the values this[i]=1.0 if left[i] is > right[i], else 0.0.

Parameters
leftis left operator value
rightis right operator value
Returns
true if both are double based and has same number of values

References dValue, getElementCnt(), getValued(), i, isDouble(), and mini().

Referenced by UVarCalcOper::evaluateV(), and getValues().

bool UVariable::setInt ( int  value,
const int  idx = 0,
bool  mayAdd = false,
UTime updT = NULL 
)
inline

Supplementary call to set single value

Parameters
valueis the value to be set for the index idx
idxvariable may be an array, default is 0.
mayAddif true and the index is higher than element cnt, then more space is allocated.
updTis an optional pointer to the update time (relevant for time series only)
Returns
true if set, returns false if index is negative or if datatype is not double based

References setValued().

Referenced by UNamedBoxes::addBox(), UFuncKinect::callGotNewDataWithObject(), UResVarPool::callVSCD(), UImagePool::createBaseVar(), UNamedBox::doDetect(), UNamedBoxes::doDetect(), UResDrivePos::driveOdo(), UResRoadDrive::driveSide(), UCamPool::findDevices(), UResAuEf::findFeatures(), UResAvoid::findPathToHere(), UImagePool::getImage(), UResMapObst::getNearObstacles(), UFakeDevice::getNewestData(), UResCamIfCam::gotNewData(), UResCamIfImg::gotNewImage(), UFuncRadar::handleCommand(), UFuncV4lGst::handleCommand(), UFuncPlan::handleFindRoute(), UFuncPlan::handleGetPoint(), UFunctionCamGmk::handleGmkGetCommand(), UResLaserIfScan::handleLaserScan(), UResLaserIfObst::handleObst(), UResLaserIfSf::handlePass(), UFuncPlan::handleResetPlan(), UResLaserIfSf::handleRoad(), UResLaserIfSf::handleSF(), UImgPush::imgUpdated(), UResIf::interfaceTick(), UResLocater::locate(), UCamPool::makeDevice(), UResLobst::makeObst(), UCamPush::needNewPushData(), UResCamIfGmk::newDataAvailable(), UResObstacle::obstDataUpdated(), UResIf::openConnection(), UFuncStereo::processImages(), UResRhdIf::run(), UFuncPiCam::run(), UFuncPiCam::runAlive(), UResMapObst::sendMapLinesToLocalizer(), UFuncLaserBox::sendToPolyPlugin(), UResLocater::set_utmstate(), UImgPush::setLogInterval(), UResRhdIf::setPort(), UResIf::setPort(), UImgPush::setTcpPort(), UKeepItem::tick(), UCmdExe::updateLocalVar(), and UResObstacle::updateMappedObstacles().

bool UVariable::setLe ( UVariable left,
UVariable right 
)

Less than or equal - element by element Make this variable an array of same size as left and right, with the values this[i]=1.0 if left[i] is <= right[i], else 0.0.

Parameters
leftis left operator value
rightis right operator value
Returns
true if both are double based and has same number of values

References dValue, getElementCnt(), getValued(), i, isDouble(), and mini().

Referenced by UVarCalcOper::evaluateV(), and getValues().

bool UVariable::setLogicalAnd ( UVariable left,
UVariable right 
)

element by element logical And values Make this variable an array of same size as left and right, with the values: this[i]= left[i] and right[i]

Parameters
leftis left operator value
rightis right operator value
Returns
true if both are double based and has same number of values

References dValue, getElementCnt(), getValued(), i, isDouble(), and mini().

Referenced by UVarCalcOper::evaluateV(), and getValues().

bool UVariable::setLogicalOr ( UVariable left,
UVariable right 
)

element by element logical OR values Make this variable an array of same size as left and right, with the values: this[i]= left[i] or right[i]

Parameters
leftis left operator value
rightis right operator value
Returns
true if both are double based and has same number of values

References dValue, getElementCnt(), getValued(), i, isDouble(), and mini().

Referenced by UVarCalcOper::evaluateV(), and getValues().

bool UVariable::setLt ( UVariable left,
UVariable right 
)

Less than - element by element Make this variable an array of same size as left and right, with the values this[i]=1.0 if left[i] is < right[i], else 0.0.

Parameters
leftis left operator value
rightis right operator value
Returns
true if both are double based and has same number of values

References dValue, getElementCnt(), getValued(), i, isDouble(), and mini().

Referenced by UVarCalcOper::evaluateV(), and getValues().

bool UVariable::setModulo ( UVariable left,
UVariable right 
)

element by element modulo operation Make this variable an array of same size as left,and operate based on first element of right with the values: this[i]= double(long(left[i]) % long(right[0]))

Parameters
leftis left operator value
rightis right operator value
Returns
true if both are double based

References dValue, getElementCnt(), getValued(), i, isDouble(), and roundi().

Referenced by UVarCalcOper::evaluateV(), and getValues().

void UVariable::setName ( const char *  newName,
int *  idx = NULL 
)

Set name of variable. Strips any index from the name. If there is an index, this is returned in *idx.

Parameters
nameof variable - nay have index, e.g. foo[8]
idxoptional pointer to integer, where index is to be returned

References cols(), MAX_VAR_NAME_SIZE, mini(), name, rows(), and splitNameIndex().

Referenced by UVarPool::addVar(), getType(), and UResRuleState::methodCallV().

bool UVariable::setNe ( UVariable left,
UVariable right 
)

Not equal Sets the value of this variable (size 1) to 1 if one or more of the elements in left is not (exactly) equal to the one on the right. The left and right size must be equal. Else the value is 0.

Parameters
leftis left operator value
rightis right operator value
Returns
true if both are double based and has same number of values

References dValue, getElementCnt(), getValued(), i, isDouble(), and setSize().

Referenced by UVarCalcOper::evaluateV(), and getValues().

bool UVariable::setNot ( )

set all element to the negated value of the current value.

Returns
true if variable is double based

References dValue, elementCnt, i, and isDoubleBased.

Referenced by UVarCalc::evaluateUnaryValV(), and getValues().

void UVariable::setParent ( UVarPool value)
inline

Set parent var pool to this variable. this is needed to let updates trigger an update event

Parameters
valuepointer to the parent var-pool, may be NULL for disabling this notify event

References parent.

Referenced by UVarPool::addVar().

bool UVariable::setPlus ( UVariable left,
UVariable right 
)

element by element sum of values Make this variable an array of same size as left and right, with the values: this[i]= left[i] + right[i]

Parameters
leftis left operator value
rightis right operator value
Returns
true if both are double based and has same number of values

References dValue, getElementCnt(), getValued(), i, isDouble(), and mini().

Referenced by UVarCalcOper::evaluateV(), and getValues().

bool UVariable::setPose ( UPose value,
UTime updT = NULL 
)
bool UVariable::setPose ( UPoseTime value,
UTime updT = NULL 
)

Set first 4 values from a UPose structure (order x, y, h, tod)

References UTime::getDecSec(), UPose::h, setValued(), UPoseTime::t, UPose::x, and UPose::y.

bool UVariable::setPow ( UVariable left,
UVariable right 
)

element by element power operation Make this variable an array of same size as left,and operate based on first element of right with the values: this[i]= pow(left[i], right[0])

Parameters
leftis left operator value
rightis right operator value
Returns
true if both are double based

References dValue, getElementCnt(), getValued(), i, and isDouble().

Referenced by UVarCalcOper::evaluateV(), and getValues().

bool UVariable::setProduct ( UVariable left,
UVariable right 
)

element by element product of values Make this variable an array of same size as left and right, with the values: this[i]= left[i] * right[i]

Parameters
leftis left operator value
rightis right operator value
Returns
true if both are double based and has same number of values

References dValue, getElementCnt(), getValued(), i, isDouble(), and mini().

Referenced by UVarCalcOper::evaluateV(), and getValues().

bool UVariable::setRot ( URotation value,
UTime updT = NULL 
)
int UVariable::setSize ( int  rows,
int  cols 
)

Set size for a variable. Sets the type to a matrix.

Parameters
rowsnumber of rows.
colsnumber of columns.
Returns
size in elements

References UVarHist::colCnt, cols(), dataType, dValue, elementCnt, getSize(), UVarLog::hasHist(), UVarLog::hist, m2, maxi(), UVarHist::rowCnt, rows(), UVarHist::setHistSize(), setType(), and setValued().

Referenced by getParent(), UFunctionCamGmk::handleGmkGetCommand(), UFunctionVarPool::handleVarValues(), setEq(), setNe(), setValued(), and setValueM().

int UVariable::setSize ( int  elements)

Set size of a double based or a string variable.

Parameters
rowsnumber of rows.
colsnumber of columns.
Returns
size in elements

References UVarHist::colCnt, elementCnt, getSize(), UVarLog::hasHist(), UVarLog::hist, isString(), UVarHist::rowCnt, UVarHist::setHistSize(), setValued(), and setValues().

bool UVariable::setString ( const char *  attValue,
const int  idx,
bool  mayAdd,
UTime updT = NULL 
)
inline

Set value of this string variable. If too little space allocated, then more is allocated if idx is not 0, then idx is the first character to be set, values befroe this is unchanged, but the string is not terminated after the value (if the original string is longer)

Parameters
attValueis a string to be added
idxindex, where the first character is to be set.
mayAddif true, then array is expanded as needed following idx and string length
updTis an optional pointer to the update time (relevant for time series only)
Returns
true if set, returns false if index is negative or if datatype is not a string

References setTime(), setTimeNow(), setValue(), setValueM(), setValueNew(), setValues(), and t.

Referenced by UFuncV4lGst::busCall().

bool UVariable::setTime ( UTime  t,
const int  idx = 0 
)
bool UVariable::setTimeNow ( const int  idx = 0)

Set value of this variable to decimal reprecentation of current time.

Parameters
idxindex, where the first character is to be set (default is 0).
Returns
true if value is set.

References UTime::getDecSec(), UTime::now(), setValued(), and t.

Referenced by UFuncPlan::handleFindRoute(), UResBin::handleNewData(), UFuncPlan::handleResetPlan(), setString(), and UCmdExe::updateLocalVar().

bool UVariable::setType ( varType  newType)

Set data type and element size If the type were different before, then the element size is changed and if the element reduced to be within the new buffer range. element count is unchanged if space allows.

Parameters
newTypeset the data type to this value
Returns
false if unknown data type - should not be

References b, d, d2d, d3d, dataType, dq, elementSize, i, isDoubleBased, m2, pose, rot, s, and t.

Referenced by UVarPool::addVar(), copy(), isString(), UResRuleState::methodCallV(), setSize(), setTypeChar(), setValued(), setValueNew(), and setValues().

bool UVariable::setTypeChar ( const char *  to)

Set data type from a character string

Parameters
toa character description of data type
Returns
a pointer to the buffer

References setType(), and typeFromChar().

Referenced by UVarCalc::evaluateUnaryValV(), and getType().

bool UVariable::setUnit ( )

Set this m2 type variable to 1.0 in diagonal and 0.0 in other elements.

Returns
true if a m2 variable

References cols(), dataType, dValue, i, m2, rows(), and setUpdated().

Referenced by descriptionBufferUsed(), and UFunctionVarPool::handleVarValues().

void UVariable::setUpdated ( UTime updTime = NULL)
protected

Set variable as updated, to notify for push events Set variable as updated, with timestamp - for local history only (if any)

Parameters
updTimetime of this update.

References UVarLog::changed(), dValue, UVarPool::getFullPreName(), UVarPool::getLogVar(), UVarPool::getLogVarLock(), UVarLog::hasHist(), isDouble(), name, UTime::now(), parent, saveToLog(), UServerPush::setUpdated(), updateQtTest(), updTimeNewest, and varFastestUpdateTime.

Referenced by copy(), decodeReplayLine(), descriptionBufferUsed(), setAll(), setDouble(), setUnit(), setValued(), setValueM(), and setValues().

bool UVariable::setValue ( const UVariable source,
const int  idx,
UTime updT = NULL 
)

Set value from this source. Optinally set just element 'elem'

Parameters
sourceis the new value
idxis the element in the destination to be set from the source if elem > 0 and type is double, then just the element is set from the first value in the source. if elem > 0 and type is string, then the source is treates as a new substring to be set at this position if elem == 0, then the source is copied to this variable in total (incl type)
updTis an optional pointer to the update time (relevant for time series only)
Returns
true if set.

References copy(), getElementCnt(), getValueBuffer(), getValued(), isString(), s, setValued(), and setValues().

Referenced by UVarPool::addVar(), UFunctionVarPool::handleVarValues(), UResRuleState::methodCallV(), UMisRuleState::setParameters(), UVarPool::setScopeVar(), and setString().

bool UVariable::setValued ( double  value,
const int  ix = 0,
bool  mayAdd = false,
UTime updT = NULL 
)

Set double type value of this variable. If too little space allocated, then more is allocated

Parameters
valueis the value to be set for the index idx
ixmay be an array, so an index is provided
mayAddif true and the index is higher than element cnt, then more space is allocated.
updTis an optional pointer to the update time (relevant for time series only)
Returns
true if set, returns false if index is negative or if datatype is not double based

References buf, byteCnt, dataType, dValue, elementCnt, elementSize, getGetAsXmlAttribute(), isDouble(), m2, s, and setUpdated().

Referenced by add(), UVarPool::addVar(), UFuncKinect::callGotNewDataWithObject(), UResIf::connectionChange(), UResDrivePos::driveOdo(), UVarCalc::evaluateUnaryValV(), UResSmrIf::eventHakoVarUpdate(), UMisControl::execute(), UFuncBallKL::findBall(), UFuncPiPi::findBall(), UFuncBall::findBall(), UFuncBall_improved::findBall(), getBool(), UVarCalc::getValueAnyV(), UFuncImu::handleCommand(), UFuncView::handleCommand(), UFuncPpl::handleCommand(), UFuncKinect::handleKinect(), UFuncLoca2::handleLocalize(), UFuncPiCam::handleNormal(), UFuncPTgrey::handlePTgrey(), UFuncStereo::handleStereo(), UFuncTOF::handleTOF(), UFunctionVarPool::handleVarValues(), UMisRuleState::initCall(), UFuncStereo::initializeStereo(), UResIf::interfaceAliveTag(), UResIf::interfaceTick(), UResSmrIf::lineStateUpdated(), UFuncPiCam::logFileTest(), UFuncKinect::logFileTest(), UResLobst::makeObst(), UResLocater::match_points(), UFuncPpl::methodCall(), UMisRuleState::methodCallV(), UVarMethod::methodCallV(), UResRuleState::methodCallV(), UMisRuleState::methodWait(), UFuncView::paintBold(), UFuncTOF::processChannel8(), UFuncTOF::processImages(), UFuncPTgrey::Receiver(), UFuncTOF::Receiver(), UFuncImu::run(), UResSmrCtl::run(), UFuncKinect::run(), UFuncPTgrey::runSetting(), UResSmrCtl::sendNewManoeuvreToSMR(), set3D(), set6D(), UResIf::setBinNameValid(), setBool(), UNamedBox::setBox(), setDouble(), setInt(), UVarPool::setLocalVar(), UResPoseHist::setMinDist(), UResPoseHist::setMinTheta(), UResPoseHist::setMinTime(), UMisRuleState::setParameters(), setPose(), UFuncView::setRangeRingCnt(), UFuncView::setRobot(), setRot(), setSize(), setTime(), setTimeNow(), setValue(), setValued(), setValueNew(), testVar(), UResPoseHist::updateVarPool(), and UFuncPpl::updateVars().

bool UVariable::setValued ( const char *  attValue,
const int  idx,
bool  mayAdd,
UTime updT = NULL 
)

Set value of this variable, assuming value can be converted to double. If too little space allocated, then more is allocated. If variable is a matrix or the attValue has ';' (as row seperator) then the size of the matrix is set from the data, and 'idx' should be set to 0.

Parameters
attValueis a string with the values for the array, at maximum the number of variables in one element is used - e.g. 3 for a d3d type
idxmay be an array, so an index is provided
mayAddif true, then array is expanded as needed following idx
updTis an optional pointer to the update time (relevant for time series only)
Returns
true if set, returns false if index is negative or if datatype is not double based

References d, dataType, elementCnt, isDouble(), m2, maxi(), name, setSize(), setType(), setValued(), and str2bool3().

bool UVariable::setValueM ( UMatrix mat,
UTime updT = NULL 
)

Set value from this source. variable is resized to match the source existing variable has too few elements

Parameters
matis the new value for the matrix variable
Returns
true if set.

References UMatrix::cols(), UMatrix::getData(), and UMatrix::rows().

Referenced by setString(), setValueM(), UFuncLoca2::updateCovStatus(), and UFuncLocalize::updateCovStatus().

bool UVariable::setValueM ( matrix *  mat,
UTime updT = NULL 
)

Set value from this source. variable is resized to match the source existing variable has too few elements

Parameters
matis the new value for the matrix variable
Returns
true if set.

References setValueM().

bool UVariable::setValueM ( int  rCnt,
int  cCnt,
double *  values,
UTime updT = NULL 
)

Set value from this source.

Parameters
rCntis the number of rows in the source array.
cCntis the number of columns in each row.
valuesis an array with rCnt*cCnt elements.
Returns
true if set.

References dValue, setSize(), and setUpdated().

bool UVariable::setValueNew ( const char *  newName,
const char *  attValue,
const char *  type,
const char *  comment 
)

Assign values to a new (empty) variable.

Parameters
newNameThe new name of the variable
attValuestring with value for variable
typestring indicationg how to interpet the value string
comment- new comment (static string - pointer used directly)
Returns
true if values are set.

References d, description, isString(), MAX_VAR_NAME_SIZE, name, none, s, setType(), setValued(), setValues(), and typeFromChar().

Referenced by setString().

bool UVariable::setValues ( const char *  attValue,
const int  idx,
bool  mayAdd,
UTime updT = NULL 
)

Set value of this string variable. If too little space allocated, then more is allocated if idx is not 0, then idx is the first character to be set, values befroe this is unchanged, but the string is not terminated after the value (if the original string is longer)

Parameters
attValueis a string to be added
idxindex, where the first character is to be set.
mayAddif true, then array is expanded as needed following idx and string length
updTis an optional pointer to the update time (relevant for time series only)
Returns
true if set, returns false if index is negative or if datatype is not a string

References byteCnt, dValue, elementCnt, elementSize, i, isString(), s, setType(), and setUpdated().

Referenced by UVarPool::addVar(), UResVarPool::callVS(), UResVarPool::callVSCD(), UResAvoid::copyAvoidObstacles(), UResAvoid::copyCellPolys(), UResAvoid::copyFootprintPolys(), UFuncPpl::drawPolygons(), UVarCalc::evaluateParametersV(), UVarCalc::evaluateUnaryValV(), UVarCalc::evaluateV(), UVarCalc::getValueAnyV(), UFunctionVarPool::handleVarValues(), UFunctionVarPool::makeAMethodCall(), UFuncKinect::makeObj3Dcloud(), UMisRuleState::methodCallV(), UResIf::openConnection(), UFunctionPassable::polygonToPolyPlugin(), UResLocater::polygonToPolyPlugin(), UFuncStraightLine::polygonToPolyPlugin(), UFuncImu::run(), UResRoseBot::sendToPolyPlugin(), UFuncLaserBox::sendToPolyPlugin(), UResIf::setBinName(), setBool(), UNamedBox::setBox(), UKeepItem::setExpr(), UResRhdIf::setHost(), UResIf::setHost(), UVarPool::setLocalVar(), UCamMounted::setMountName(), UKeepItem::setName(), UFuncKinect::setPointCloudUpdated(), setSize(), setString(), UCamDevBase::setTypeName(), setValue(), and setValueNew().

void UVariable::snprint ( const char *  preString,
char *  buff,
const int  buffCnt 
)
virtual

Print status for this structure

Reimplemented from UDataBase.

References dValue, getValuesdAsString(), isString(), and name.

Referenced by getDataType().

bool UVariable::splitNameIndex ( const char *  nameWithIndex,
int *  index,
int *  col,
int *  nameLng 
)
static

Split name, assuming an index is embedded in the name. The function finds first index only, no decimals allowed in index. Can be called with no object e.g. 'data[3]' returns true and index=3 length = 4 e.g. 'data[ 3 ]' returns true and index=3 length = 4 e.g. 'data[3][6]' returns true and index=3 length = 4 e.g. 'data[3,6]' returns true and index=3, col=6 length = 4 e.g. 'data[3 6]' returns true and index=3, col=6 length = 4 e.g. 'data' returns true and index=0 length = 4 e.g. 'data[]' returns true and index=0 length = 4 e.g. 'data[3.0]' returns false and index=3 length = 4 e.g. 'data[3' returns false and index=3 length = 4

Parameters
nameWithIndexis the full name, e.g. 'data[3]'
indexis where the index is returned e.g. 3
nameLngis where the length without index is returned e.g. 4
Returns
true if format is as expected. Split name, assuming an index is embedded in the name. The function finds also index for arrays - i.e. [1,4] is fifth element in row two, and returns index 9 if matrix has 5 columns, i.e. index is row*columns+col from name[row,col]. e.g. 'data[3]' returns true and index=3 length = 4 e.g. 'data[ 3 ]' returns true and index=3 length = 4 e.g. 'data[3][6]' returns true and index=3 length = 4 e.g. 'data[3,6]' returns true and index=3, col=6 length = 4 e.g. 'data[3 6]' returns true and index=3, col=6 length = 4 e.g. 'data' returns true and index=0 length = 4 e.g. 'data[]' returns true and index=0 length = 4 e.g. 'data[3.0]' returns false and index=3 length = 4 e.g. 'data[3' returns false and index=3 length = 4
Parameters
nameWithIndexis the full name, e.g. 'data[3]'
indexis where the index is returned e.g. 3
colis set to column index, if specified as a matrix (and not NULL)
nameLngis where the length without index is returned e.g. 4
Returns
true if format is as expected.

Referenced by UVarPool::getLocalVarIndex(), getType(), and setName().

UVariable::varType UVariable::typeFromChar ( const char *  typ)
static

Get variable type from a character representattion

References b, d, d2d, d3d, d6d, dq, i, m2, none, pose, rot, s, and t.

Referenced by UVarPool::addVar(), UVarPool::addVarA(), getType(), setTypeChar(), and setValueNew().

void UVariable::updateQtTest ( float  holdTime)

Test if this variable needs to be updated to theQT gui

References qevent, updTimeLast, updTimeNewest, and UQevent::varUpdatedEvent().

Referenced by descriptionBufferUsed(), setUpdated(), and UResVarPool::updateQTvars().

Member Data Documentation

int UVariable::byteCnt
protected

size of data buffer in bytes

Referenced by copy(), getByteCnt(), setValued(), setValues(), UVariable(), and ~UVariable().

varType UVariable::dataType
protected

Variable type - may be part of a semistructure (or a string) p.t. the following types are defined d : the default double - or double array dq : an array of 2 values aaaX, aaaQ - a value with an associated quality pose : an array of 3 values aaaX aaaY aaaH - in this order 2d : an array of 2 values aaaX aaaY - in this order 3d : an array of 3 values aaaX aaaY aaaZ - in this order 6d : an array of 6 values aaaX aaaY aaaZ aaaO aaaP aaaK - in this order rot : an array of 3 values aaaO aaaP aaaK - in this order s : a string m2 : 2-dimensional matrix (first 2 elements are rows and columns)

Referenced by cols(), copy(), getM(), getSize(), getType(), getTypeChar(), getValued(), getValuedAsString(), getValuesd(), getValuesdAsString(), isTypeA(), rows(), setAll(), setSize(), setType(), setUnit(), setValued(), and UVariable().

const char* UVariable::description
char* UVariable::descriptionBuffer
private

Description data buffer

Referenced by copy(), descriptionBufferUsed(), setDescription(), UVariable(), and ~UVariable().

double* UVariable::dValue
protected
int UVariable::elementCnt
protected
int UVariable::elementSize
protected

size of one data element - in bytes

Referenced by copy(), isString(), setDouble(), setType(), setValued(), setValues(), and UVariable().

bool UVariable::isDoubleBased
protected
char UVariable::name[MAX_VAR_NAME_SIZE+1]
UVarPool* UVariable::parent
protected

Pointer to parent var pool - especially for update notification

Referenced by getParent(), openVarLog(), setParent(), setUpdated(), and UVariable().

UTime UVariable::updTimeLast
protected

Last update time to qt

Referenced by updateQtTest().

UTime UVariable::updTimeNewest
protected

Latest update time

Referenced by setUpdated(), and updateQtTest().


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