Updated version to 0.3. Now when deleting the memory, RTAB-Map reset the log files at the same time.

git-svn-id: http://rtabmap.googlecode.com/svn/trunk/rtabmap@209 f169173b-cf89-36c8-b27e-44dbe73f0c83
This commit is contained in:
matlabbe
2011-06-21 17:19:45 +00:00
parent 6a84c99abc
commit fb48cce623
5 changed files with 28 additions and 19 deletions

View File

@@ -115,7 +115,7 @@ private:
void deleteMemory();
void addSMState(SMState * data); // ownership is transferred
SMState * getSMState();
void setupLogFiles();
void setupLogFiles(bool overwrite = false);
void releaseAllStrategies();
void pushNewState(State newState, const ParametersMap & parameters = ParametersMap());
void dumpPrediction() const;

View File

@@ -110,7 +110,7 @@ std::string Rtabmap::getVersion()
return RTABMAP_VERSION;
}
void Rtabmap::setupLogFiles()
void Rtabmap::setupLogFiles(bool overwrite)
{
// Log files
if(_foutFloat)
@@ -124,12 +124,21 @@ void Rtabmap::setupLogFiles()
_foutInt = 0;
}
std::string attributes = "a+"; // append to log files
if(overwrite)
{
// If a file with the same name already exists
// its content is erased and the file is treated
// as a new empty file.
attributes = "w";
}
#ifdef _MSC_VER
fopen_s(&_foutFloat, (_wDir+LOG_F).toStdString().c_str(), "a+");
fopen_s(&_foutInt, (_wDir+LOG_I).toStdString().c_str(), "a+");
fopen_s(&_foutFloat, (_wDir+LOG_F).toStdString().c_str(), attributes.c_str());
fopen_s(&_foutInt, (_wDir+LOG_I).toStdString().c_str(), attributes.c_str());
#else
_foutFloat = fopen((_wDir+LOG_F).c_str(), "a+");
_foutInt = fopen((_wDir+LOG_I).c_str(), "a+");
_foutFloat = fopen((_wDir+LOG_F).c_str(), attributes.c_str());
_foutInt = fopen((_wDir+LOG_I).c_str(), attributes.c_str());
#endif
ULOGGER_DEBUG("Log file (int)=%s", (_wDir+LOG_I).c_str());
@@ -522,7 +531,7 @@ void Rtabmap::deleteMemory()
_reactivateId = 0;
_highestHypothesisValue = 0;
_spreadMargin = 0;
this->setupLogFiles();
this->setupLogFiles(true);
}
void Rtabmap::handleEvent(UEvent* event)