mirror of
https://github.com/introlab/rtabmap_ros.git
synced 2026-10-06 01:37:46 +08:00
Fixed saving/loading dictionary (not loaded words)
git-svn-id: http://rtabmap.googlecode.com/svn/trunk/rtabmap@676 f169173b-cf89-36c8-b27e-44dbe73f0c83
This commit is contained in:
@@ -178,7 +178,7 @@ void DBDriver::emptyTrashes(bool async)
|
||||
if(this->isConnected())
|
||||
{
|
||||
//Only one query to the database
|
||||
this->saveQuery(uValues(visualWords));
|
||||
this->saveOrUpdate(uValues(visualWords));
|
||||
}
|
||||
|
||||
for(std::map<int, VisualWord *>::iterator iter=visualWords.begin(); iter!=visualWords.end(); ++iter)
|
||||
@@ -223,7 +223,6 @@ void DBDriver::asyncSave(VisualWord * vw)
|
||||
}
|
||||
}
|
||||
|
||||
//Automatically begin and commit a transaction
|
||||
void DBDriver::saveOrUpdate(const std::vector<Signature *> & signatures) const
|
||||
{
|
||||
ULOGGER_DEBUG("");
|
||||
@@ -254,6 +253,36 @@ void DBDriver::saveOrUpdate(const std::vector<Signature *> & signatures) const
|
||||
}
|
||||
}
|
||||
|
||||
void DBDriver::saveOrUpdate(const std::vector<VisualWord *> & words) const
|
||||
{
|
||||
ULOGGER_DEBUG("");
|
||||
std::list<VisualWord *> toSave;
|
||||
std::list<VisualWord *> toUpdate;
|
||||
if(this->isConnected() && words.size())
|
||||
{
|
||||
for(std::vector<VisualWord *>::const_iterator i=words.begin(); i!=words.end();++i)
|
||||
{
|
||||
if((*i)->isSaved())
|
||||
{
|
||||
toUpdate.push_back(*i);
|
||||
}
|
||||
else
|
||||
{
|
||||
toSave.push_back(*i);
|
||||
}
|
||||
}
|
||||
|
||||
if(toUpdate.size())
|
||||
{
|
||||
this->updateQuery(toUpdate);
|
||||
}
|
||||
if(toSave.size())
|
||||
{
|
||||
this->saveQuery(toSave);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void DBDriver::load(VWDictionary * dictionary) const
|
||||
{
|
||||
_dbSafeAccessMutex.lock();
|
||||
|
||||
Reference in New Issue
Block a user