AURobotServers
4
|
#include <ureplay.h>
Public Member Functions | |
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) |
virtual void | updateReplayStatus () |
UReplay () | |
virtual | ~UReplay () |
Public Attributes | |
bool | replayTimeAdvancePending |
UTime | replayTimeNow |
Protected Attributes | |
bool | replay |
FILE * | replayFile |
char | replayFileName [REPLAY_FILE_NAME_LENGTH] |
replay filename More... | |
char | replayLine [MAX_LOG_LINE_LENGTH] |
int | replayLogLine |
UReplay * | replayParent |
UTime | replayTimeNext |
Static Protected Attributes | |
static const int | MAX_LOG_LINE_LENGTH = 10000 |
static const int | REPLAY_FILE_NAME_LENGTH = 264 |
max length of replay filename More... | |
Private Attributes | |
UReplay ** | childs |
list of childs that needs to be informed of replay steps. More... | |
int | childsCnt |
number of childs in the child list. More... | |
Base class for a shared resource. Includes commen handling of replay.
UReplay::UReplay | ( | ) |
Constructor
References childs, childsCnt, replay, replayFile, replayFileName, replayLine, replayLogLine, replayParent, and replayTimeAdvancePending.
|
virtual |
Destructor
References replayFile.
void UReplay::addChild | ( | UReplay * | child | ) |
Add a child to this replay structure.
References childs, and childsCnt.
Referenced by setParent(), and updateReplayStatus().
|
inlinevirtual |
Decode this replay line, that is assumed to be valid.
line | is a pointer to the line. |
Reimplemented in UResGps, UCamPool, UVarHist, UImagePool, and UFuncKinect.
References getLogFileName(), getReplayFileName(), replaySetBaseFileName(), replaySetFileName(), replayStep(), and setReplay().
Referenced by replayStep().
char* UReplay::getLogFileName | ( | char * | fn, |
const int | fnCnt | ||
) |
Get the full logfile name. This is the data path followed by the resource name and the '.log' extension
fn | buffer for destination filename |
fnCnt | is the length of the provided buffer Returns pointer to fn[] string. |
Referenced by decodeReplayLine().
char * UReplay::getReplayFileName | ( | char * | fn, |
const int | fnCnt | ||
) |
Get the full replay logfile name. This is the replay path followed by the resource name and the '.log' extension
fn | buffer for destination filename |
fnCnt | is the length of the provided buffer Returns pointer to fn[] string. |
References replayFileName, and replayPath.
Referenced by decodeReplayLine(), UFunctionImgPool::handleImageSetCommand(), UFuncKinect::handleKinect(), UFunctionVarPool::handleVarValues(), UFunctionVarPool::sendVar(), and setReplay().
|
inline |
Get current replay log linenumber
Referenced by UFunctionVarPool::sendVar().
|
inline |
Is the resource in replay mode
References replay.
Referenced by UFunctionCam::handleCamSetCommand(), UFunctionGps::handleCommand(), UFunctionIf::handleIf(), UFunctionImgPool::handleImageSetCommand(), UFuncKinect::handleKinect(), UFunctionPoseHist::handlePoseHistCommand(), UResPool::handleReplay(), UFuncKinect::updateReplayStatus(), UImagePool::updateReplayStatus(), and UResBase::updateReplayStatus().
|
inline |
Is the resource in replay mode
References replayFile.
Referenced by UFunctionVarPool::sendVar(), and UFunctionVarPool::sendVarList().
void UReplay::removeChild | ( | UReplay * | child | ) |
Remove this child from replay list
child | is a pointer to the replay structure of the child to be removed. The child pointer is removed and the cound of children is decreased. If child is not found, then nothing happends. |
References childs, and childsCnt.
Referenced by updateReplayStatus().
|
virtual |
Advance replay for all resources in replay mode until just before this time The function sets a flag and the steps are performed in main command thread as soon as possible (before next user queue, and before push events)
Reimplemented in ULaserPool.
References replayAdvanceTime(), replayParent, replayTimeAdvancePending, and replayTimeNow.
Referenced by UCmdExe::handleServerCommand(), replayAdvanceTime(), ULaserPool::replayAdvanceTime(), replayStep(), UReplayDevice::replayStep(), UResPoseHist::replayStep(), and UReplayDevice::replayStepToScan().
void UReplay::replaySetBaseFileName | ( | const char * | name, |
const char * | preName = "" |
||
) |
Set basename for replay file, this is preceded by the replay path and a '.log' is added.
name | logfile name (excluding replay path and .log extension) |
preName | optional additional string inserted just in front of name (no '/' or '.' added) |
References REPLAY_FILE_NAME_LENGTH, replayFile, and replayFileName.
Referenced by UFunctionImgPool::createResources(), UFunctionGps::createResources(), UFuncPiCam::createResources(), UFuncKinect::createResources(), and decodeReplayLine().
void UReplay::replaySetFileName | ( | const char * | name | ) |
Set new replay file name (fully qualified filename). If replay is in progress, then the old file is closed, before assigning the new name.
name | is the new mane. |
References REPLAY_FILE_NAME_LENGTH, replayFile, and replayFileName.
Referenced by decodeReplayLine(), and UCamPool::UCamPoolInit().
|
virtual |
Replay one step in the logfile.
Reimplemented in UResPoseHist, and UPoseHistNotUsed.
References decodeReplayLine(), MAX_LOG_LINE_LENGTH, replay, replayFile, replayFileName, replayLine, replayLogLine, replayTimeNext, replayTimeNow, setReplay(), UTime::setTimeTod(), updateReplayStatus(), and UTime::valid.
Referenced by decodeReplayLine(), UFunctionCam::handleCamSetCommand(), UFunctionGps::handleCommand(), UFunctionImgPool::handleImageSetCommand(), UFuncKinect::handleKinect(), UFunctionVarPool::handleVarValues(), replayStep(), and replayToTime().
int UReplay::replayStep | ( | int | steps | ) |
Replay N singles from the logfile.
steps | number of steps to advance the line number reached in the replay file and -1 if no usable file. |
References replay, replayAdvanceTime(), replayLogLine, replayStep(), and replayTimeNow.
|
virtual |
Advance replay for this resources - if in replay mode - until just before this time
untilTime | advance with steps in logfile until this time is reached |
Reimplemented in UResIf, and ULaserPool.
References childs, childsCnt, replay, replayStep(), replayTimeNext, and replayToTime().
Referenced by UFunctionPoseHist::handlePoseHistCommand(), UResPool::handleReplay(), and replayToTime().
void UReplay::setParent | ( | UReplay * | parent | ) |
Set replay parent
pointer | to parent, parent has to be informed on steps, and if this child is deleted, then parent will inform if other childs has advanced. |
References addChild(), and replayParent.
Referenced by updateReplayStatus().
bool UReplay::setReplay | ( | bool | value | ) |
Set replay flag.
value | if true, then the logfile (name.log) is attempted opened. If not successfull, the replay flag is still set to true, and attemped opened at next step true if replay file is opened or not |
References getReplayFileName(), MAX_LOG_LINE_LENGTH, replay, replayFile, replayLine, replayLogLine, replayTimeNext, UTime::setTimeTod(), updateReplayStatus(), and UTime::valid.
Referenced by decodeReplayLine(), UVarLog::getUpdTime(), UFunctionCam::handleCamSetCommand(), UFunctionGps::handleCommand(), UFunctionImgPool::handleImageSetCommand(), UFuncKinect::handleKinect(), UFunctionVarPool::handleVarValues(), and replayStep().
|
inlinevirtual |
If replay status is maintained in global vars, then it is time to update
Reimplemented in UResBase, UImagePool, and UFuncKinect.
References addChild(), removeChild(), and setParent().
Referenced by replayStep(), and setReplay().
|
private |
list of childs that needs to be informed of replay steps.
Referenced by addChild(), removeChild(), replayToTime(), and UReplay().
|
private |
number of childs in the child list.
Referenced by addChild(), removeChild(), replayToTime(), and UReplay().
|
staticprotected |
Maximum length of a line in the logfile
Referenced by replayStep(), and setReplay().
|
protected |
Is the resource in replay mode - this may trigger an update to time call
Referenced by isReplay(), replayStep(), replayToTime(), setReplay(), and UReplay().
|
staticprotected |
max length of replay filename
Referenced by replaySetBaseFileName(), replaySetFileName(), and UResBase::setResID().
|
protected |
Replay file handle
Referenced by isReplayFileOpen(), replaySetBaseFileName(), replaySetFileName(), replayStep(), setReplay(), UResBase::updateReplayStatus(), UReplay(), ~UReplay(), and UResBase::~UResBase().
|
protected |
replay filename
Referenced by getReplayFileName(), replaySetBaseFileName(), replaySetFileName(), replayStep(), UResBase::setResID(), and UReplay().
|
protected |
Buffer for latest line (but not used) line from logfile
Referenced by UCamPool::decodeReplayLine(), replayStep(), setReplay(), and UReplay().
|
protected |
Current line number in logfile
Referenced by replayStep(), setReplay(), UResBase::updateReplayStatus(), and UReplay().
|
protected |
if not a resource itself, then set pointer to parent resource, to handle the replay of other foles
Referenced by UVarLog::getUpdTime(), replayAdvanceTime(), setParent(), and UReplay().
bool UReplay::replayTimeAdvancePending |
replay to time needs an update - set by the replay advance time call and reset by main command thread when serviced.
Referenced by UResPool::handleReplay(), replayAdvanceTime(), and UReplay().
|
protected |
Next Replay time available in logfile
Referenced by UResPoseHist::getReplayTimeNext(), UFunctionPoseHist::handlePoseHistCommand(), UFunctionLaser::handleSetCommand(), replayStep(), UResPoseHist::replayStep(), replayToTime(), setReplay(), and UResPoseHist::setReplay().
UTime UReplay::replayTimeNow |
Current replay time, and the time that should be advanced to by all other replaying devices
Referenced by UResPoseHist::getReplayTimeNow(), UFunctionCam::handleCamSetCommand(), UResPool::handleReplay(), UCmdExe::handleServerCommand(), replayAdvanceTime(), replayStep(), UResPoseHist::replayStep(), and UResBase::updateReplayStatus().