Go to the documentation of this file.00001 #ifndef __creaImageIOTimestampDatabaseHandler_h_INCLUDED__
00002 #define __creaImageIOTimestampDatabaseHandler_h_INCLUDED__
00003 #include <vector>
00004 #include <map>
00005 #include <creaImageIOTree.h>
00006 class CppSQLite3DB;
00007
00008 namespace creaImageIO
00009 {
00010 using namespace std;
00011
00013 class TimestampDatabaseHandler
00014 {
00015 public:
00016
00018 TimestampDatabaseHandler(const std::string& filename);
00020 virtual ~TimestampDatabaseHandler();
00021
00022
00023
00025 const std::string& GetFileName() const { return mFileName; }
00026
00027
00028
00029
00030
00031
00032
00034 bool Open();
00036 bool Close();
00038 bool Create();
00040 bool Destroy();
00041
00042
00043
00044
00045
00046
00048 std::string IsIndexed(const std::string& path, const std::string& refdb);
00050 bool AddDirectory(const std::string& parent,
00051 const std::string& path,
00052 const time_t lastModif,
00053 const time_t lastRead,
00054 const std::string& refdb);
00056 void AddFile(const std::string& path, const time_t lastModif, const time_t lastRead, const std::string& refdb);
00058 void AddFile(const std::string& parentId,const std::string& path, const time_t lastModif, const time_t lastRead, const std::string& refdb);
00060 void SetAttribute(const std::string& attName,
00061 const std::string& attValue,
00062 const std::string& searchParam,
00063 const std::string& searchValue);
00065 void RemoveNode(const std::string& searchAtt, const tree::Node* node, const std::string& refdb);
00067 void RemoveFile(const std::string& searchAtt, const std::string& searchVal, const std::string& refdb);
00069 void CleanPath(std::string& str) const;
00071
00072 bool CheckTimestamp(const std::string pathId, const time_t lastModif, const std::string& refdb);
00074 void RemoveEntries(const std::string i_table,
00075 const std::string i_attribute,
00076 const std::string i_operand,
00077 const std::string i_val);
00078
00079
00080
00081
00082 protected:
00083
00085 bool DBOpen();
00086
00087
00088
00090 bool DBCreate();
00091
00092
00093
00094 void DBRemove(const std::string& searchAtt, const std::string& searchVal, const std::string& refdb);
00095
00096 private:
00098 CppSQLite3DB* mDB;
00100 std::string mFileName;
00101
00102 };
00103
00104
00105
00106
00107 }
00108
00109
00110 #endif
00111