/* * Copyright (C) 2010-2011, Mathieu Labbe and IntRoLab - Universite de Sherbrooke * * This file is part of RTAB-Map. * * RTAB-Map is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * RTAB-Map is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with RTAB-Map. If not, see . */ #ifndef DBDRIVERSQLITE3_H_ #define DBDRIVERSQLITE3_H_ #include "rtabmap/core/RtabmapExp.h" // DLL export/import defines #include "rtabmap/core/DBDriver.h" #include namespace rtabmap { class RTABMAP_EXP DBDriverSqlite3: public DBDriver { public: DBDriverSqlite3(const ParametersMap & parameters = ParametersMap()); virtual ~DBDriverSqlite3(); virtual void parseParameters(const ParametersMap & parameters); void setDbInMemory(bool dbInMemory); void setJournalMode(int journalMode); void setCacheSize(unsigned int cacheSize); private: virtual bool connectDatabaseQuery(const std::string & url); virtual void disconnectDatabaseQuery(); virtual bool isConnectedQuery() const; virtual long getMemoryUsedQuery() const; // In bytes virtual bool executeNoResultQuery(const std::string & sql) const; virtual bool changeWordsRefQuery(const std::map & refsToChange) const; // virtual bool deleteWordsQuery(const std::vector & ids) const; virtual bool getNeighborIdsQuery(int signatureId, std::set & neighbors) const; virtual bool getWeightQuery(int signatureId, int & weight) const; virtual bool getLoopClosureIdQuery(int signatureId, int & loopId) const; virtual bool addNeighborQuery(int id, int newNeighbor, int oldNeighbor) const; virtual bool saveQuery(const std::vector & visualWords) const; virtual bool updateQuery(const std::list & signatures) const; virtual bool saveQuery(const KeypointSignature * ss) const; virtual bool saveQuery(const std::list & signatures) const; // Load objects virtual bool loadQuery(VWDictionary * dictionary) const; virtual bool loadLastSignaturesQuery(std::list & signatures) const; virtual bool loadQuery(int signatureId, Signature ** s) const; virtual bool loadQuery(int wordId, VisualWord ** vw) const; virtual bool loadQuery(int signatureId, KeypointSignature * ss) const; virtual bool loadKeypointSignaturesQuery(const std::list & ids, std::list & signatures, bool onlyParents = false) const; virtual bool loadWordsQuery(const std::list & wordIds, std::list & vws) const; virtual bool loadNeighborsQuery(int signatureId, std::map > > & neighbors) const; virtual bool getImageCompressedQuery(int id, CvMat ** compressed) const; virtual bool getAllSignatureIdsQuery(std::set & ids) const; virtual bool getLastSignatureIdQuery(int & id) const; virtual bool getLastVisualWordIdQuery(int & id) const; virtual bool getSurfNiQuery(int signatureId, int & ni) const; virtual bool getChildrenIdsQuery(int signatureId, std::list & ids) const; virtual bool getHighestWeightedSignaturesQuery(unsigned int count, std::multimap & ids) const; private: int loadOrSaveDb(sqlite3 *pInMemory, const std::string & fileName, int isSave) const; private: sqlite3 * _ppDb; bool _dbInMemory; unsigned int _cacheSize; int _journalMode; }; } #endif /* DBDRIVERSQLITE3_H_ */