AURobotServers
4
|
#include <uvarlog.h>
Public Member Functions | |
void | changed (double *data, bool isDouble=true, UTime *updTime=NULL) |
virtual bool | decodeReplayLine (char *) |
virtual int | getElementCnt2 () const |
int | getHistoryRows () |
const char * | getLogFilename () |
int | getMeanMinMax (int element, UTime toTime, double *mean, double *min, double *max, int sampleInterval=1) |
UMatrix * | getTimeSeries (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 () |
Public Attributes | |
UVarHist * | hist |
A variable history maintainer
UVarLog::UVarLog | ( | ) |
Constructor
|
virtual |
Destructor
|
inline |
|
inlinevirtual |
Decode this replay line, that is assumed to be valid.
line | is a pointer to the line. |
Reimplemented in UVariable.
Referenced by UVarHist::decodeReplayLine().
|
inlinevirtual |
Get number of elements
Reimplemented in UVariable.
References UVarHist::getMeanMinMax(), UVarHist::getTimeSeries(), UVarHist::getTimeVector(), UVarHist::getVectorToTime(), and min.
|
inline |
Get number of rows in the time series.
|
inline |
Get logfile name (full path)
Referenced by UFunctionVarPool::handleVar().
int UVarLog::getMeanMinMax | ( | int | element, |
UTime | toTime, | ||
double * | mean, | ||
double * | min, | ||
double * | max, | ||
int | sampleInterval = 1 |
||
) |
Get some statistics from the time series
element | is the element (history column) to use, 0=first element. |
toTime | is the end time where the vector should end. |
mean | is set to the mean value in the specified time series (unchanged if no data) - may be NULL |
min | is set to the minimum value in the specified time series (unchanged if no data) - may be NULL |
max | is set to the maximum value in the time series (unchanged if no data) - may be NULL. |
sampleInterval | is the interval between samples to test (default is 1) |
Get time series as a matrix with all comumns a maximum of rows. The first row is the newest (history) data (not current data). the buffer matrix will be resized (if needed) to fit data size.
buffer | is the matrix that is to be filled with the data. |
maxRows | is the maximum size of the data. |
Referenced by testVar().
int UVarLog::getTimeVector | ( | double * | buffer, |
int | bufferCnt, | ||
int | element | ||
) |
Get a time series vector from current history
buffer | is a result buffer for the values |
bufferCnt | is the size of the buffer (maximum this number of elements will be loaded into buffer. |
element | is the element (history column) to use, 0=first element. |
|
inline |
Get update time of newest element
References ULogFile::openLog(), UReplay::replayParent, and UReplay::setReplay().
int UVarLog::getVectorToTime | ( | double * | buffer, |
int | bufferCnt, | ||
int | element, | ||
UTime | tot, | ||
int | interval, | ||
double * | gotdt | ||
) |
Get a time series vector from current history with specifiet update rate and end time. if update rate is not possible, then average rate is returned. The method is to skip recorded updates until specified dt is passed, then use and increase to next expected time
buffer | is a result buffer for the values |
bufferCnt | is the size of the buffer (maximum this number of elements will be loaded into buffer. |
element | is the element (history column) to use, 0=first element. |
tot | is the end time where the vector should end. |
interval | is interval of the samples taken, 1 is all, 2 is every second. |
gotdt | is the (average) sample rate of saved data. |
|
inline |
Has a log history been initialized
Referenced by UVariable::copy(), UVariable::getValuedAsString(), UFunctionVarPool::handleVar(), UFunctionVarPool::handleVarValues(), UFunctionVarPool::sendVar(), UFunctionVarPool::sendVarList(), UVarPool::setLocalVar(), UVariable::setSize(), and UVariable::setUpdated().
bool UVarLog::makeHist | ( | int | histCnt, |
int | elementCnt, | ||
double | maxUpdateRate | ||
) |
Make time series history for this variable
varCnt | is the number of variable to be allocated for on-line history. |
elementCnt | is number of elements in each history entry. |
maxUpdateRate | is the maximum update rewate for the time series (must be greater than 1e-6)' |
References UVarHist::UVarHist().
Referenced by UVariable::makeTimeSeries(), and testVar().
bool UVarLog::openLog | ( | bool | doOpen, |
const char * | preName = NULL , |
||
const char * | varName = NULL |
||
) |
Open log
doOpen | if true: opens replay file and set replay status - requires name and resource parent to work. if false: closes replay file and stops replay. |
varParent | is the variable owner of this history structure (mainly used during replay) |
preName | is the full name of the structure that holds the variable (may be empty) (supposed to end in a '.'), this will be part of the filename. |
varName | is the variable name and is added to the replay path, the pre-name and extended with a .log to form the full logfile name. |
Referenced by UVariable::openVarLog().
bool UVarLog::setMaxUpdateRate | ( | double | maxUpdateRate | ) |
Set maksimum update rate for time series
maxUpdateRate | is the maximum update rewate for the time series (must be greater than 1e-6)' |
Referenced by UFunctionVarPool::handleVarValues().
bool UVarLog::setReplay | ( | bool | doOpen, |
const char * | preName, | ||
const char * | varName, | ||
UReplay * | replayParent | ||
) |
Open log
doOpen | if true: opens replay file and set replay status - requires name and resource parent to work. if false: closes replay file and stops replay. |
varParent | is the variable owner of this history structure (mainly used during replay) |
preName | is the full name of the structure that holds the variable (may be empty) (supposed to end in a '.'), this will be part of the filename. |
varName | is the variable name and is added to the replay path, the pre-name and extended with a .log to form the full logfile name. |
parent | is the resource replay parent (that will be informed on steps). |
Referenced by UFunctionVarPool::handleVarValues().
UVarHist* UVarLog::hist |
Print status for this structure
Referenced by UVariable::copy(), UVariable::getValuedAsString(), UFunctionVarPool::handleVar(), UFunctionVarPool::handleVarValues(), UVariable::openVarLog(), UFunctionVarPool::sendVar(), UFunctionVarPool::sendVarList(), and UVariable::setSize().