creaImageIO_lib
|
Concrete TreeHandler which manages a Tree stored in a sqlite database. More...
#include <creaImageIOTimestampDatabaseHandler.h>
Public Member Functions | |
TimestampDatabaseHandler (const std::string &filename) | |
Ctor with database file name. More... | |
virtual | ~TimestampDatabaseHandler () |
Dtor. More... | |
const std::string & | GetFileName () const |
Returns the sqlite db file name. More... | |
bool | Open () |
Opens an existing 'source'. More... | |
bool | Close () |
Closes the 'source'. More... | |
bool | Create () |
Creates a new 'source'. More... | |
bool | Destroy () |
Destroys the 'source'. More... | |
std::string | IsIndexed (const std::string &path, const std::string &refdb) |
Returns the id of the path if it's indexed, blank otherwise. More... | |
bool | AddDirectory (const std::string &parent, const std::string &path, const time_t lastModif, const time_t lastRead, const std::string &refdb) |
Sets the current path's parent. More... | |
void | AddFile (const std::string &path, const time_t lastModif, const time_t lastRead, const std::string &refdb) |
Adds a new file to the database without a parent. More... | |
void | AddFile (const std::string &parentId, const std::string &path, const time_t lastModif, const time_t lastRead, const std::string &refdb) |
Adds a new file to the database with a parent. More... | |
void | SetAttribute (const std::string &attName, const std::string &attValue, const std::string &searchParam, const std::string &searchValue) |
Sets the attribute to the value passed as parameter where the searchParameter is searchValue. More... | |
void | RemoveNode (const std::string &searchAtt, const tree::Node *node, const std::string &refdb) |
Removes the given node. More... | |
void | RemoveFile (const std::string &searchAtt, const std::string &searchVal, const std::string &refdb) |
Removes the filename with the given pathname. More... | |
void | CleanPath (std::string &str) const |
Cleans the path name. More... | |
bool | CheckTimestamp (const std::string pathId, const time_t lastModif, const std::string &refdb) |
Checks the timestamp in the database and compares it with the given one. More... | |
void | RemoveEntries (const std::string i_table, const std::string i_attribute, const std::string i_operand, const std::string i_val) |
Removes the entries that match the given parameters. More... | |
Protected Member Functions | |
bool | DBOpen () |
Open the database. More... | |
bool | DBCreate () |
Creates a new database on disk and the tables. More... | |
void | DBRemove (const std::string &searchAtt, const std::string &searchVal, const std::string &refdb) |
Private Attributes | |
CppSQLite3DB * | mDB |
The DB. More... | |
std::string | mFileName |
The physical location associated to the DicomDatabase (directory, db file...) More... | |
Concrete TreeHandler which manages a Tree stored in a sqlite database.
Definition at line 41 of file creaImageIOTimestampDatabaseHandler.h.
creaImageIO::TimestampDatabaseHandler::TimestampDatabaseHandler | ( | const std::string & | filename | ) |
Ctor with database file name.
Definition at line 41 of file creaImageIOTimestampDatabaseHandler.cpp.
References GimmickMessage, mDB, and CppSQLite3DB::SQLiteVersion().
|
virtual |
bool creaImageIO::TimestampDatabaseHandler::AddDirectory | ( | const std::string & | parent, |
const std::string & | path, | ||
const time_t | lastModif, | ||
const time_t | lastRead, | ||
const std::string & | refdb | ||
) |
Sets the current path's parent.
Definition at line 218 of file creaImageIOTimestampDatabaseHandler.cpp.
References AddFile(), CheckTimestamp(), CleanPath(), IsIndexed(), and SetAttribute().
void creaImageIO::TimestampDatabaseHandler::AddFile | ( | const std::string & | path, |
const time_t | lastModif, | ||
const time_t | lastRead, | ||
const std::string & | refdb | ||
) |
Adds a new file to the database without a parent.
Definition at line 273 of file creaImageIOTimestampDatabaseHandler.cpp.
References UPDATETIMESTAMPDB.
Referenced by AddDirectory().
void creaImageIO::TimestampDatabaseHandler::AddFile | ( | const std::string & | parentId, |
const std::string & | path, | ||
const time_t | lastModif, | ||
const time_t | lastRead, | ||
const std::string & | refdb | ||
) |
Adds a new file to the database with a parent.
Definition at line 284 of file creaImageIOTimestampDatabaseHandler.cpp.
References UPDATETIMESTAMPDB.
bool creaImageIO::TimestampDatabaseHandler::CheckTimestamp | ( | const std::string | pathId, |
const time_t | lastModif, | ||
const std::string & | refdb | ||
) |
Checks the timestamp in the database and compares it with the given one.
Definition at line 419 of file creaImageIOTimestampDatabaseHandler.cpp.
References CppSQLite3Query::eof(), CppSQLite3Query::getFloatField(), CppSQLite3Query::nextRow(), CppSQLite3Query::numFields(), QUERYTIMESTAMPDB, and SetAttribute().
Referenced by AddDirectory().
void creaImageIO::TimestampDatabaseHandler::CleanPath | ( | std::string & | str | ) | const |
Cleans the path name.
Definition at line 203 of file creaImageIOTimestampDatabaseHandler.cpp.
Referenced by AddDirectory(), IsIndexed(), and SetAttribute().
bool creaImageIO::TimestampDatabaseHandler::Close | ( | ) |
Closes the 'source'.
Definition at line 71 of file creaImageIOTimestampDatabaseHandler.cpp.
bool creaImageIO::TimestampDatabaseHandler::Create | ( | ) |
Creates a new 'source'.
Definition at line 63 of file creaImageIOTimestampDatabaseHandler.cpp.
References DBCreate().
|
protected |
Creates a new database on disk and the tables.
Definition at line 151 of file creaImageIOTimestampDatabaseHandler.cpp.
References CppSQLite3Exception::errorCode(), CppSQLite3Exception::errorMessage(), GetFileName(), GimmickError, GimmickMessage, mDB, CppSQLite3DB::open(), and UPDATETIMESTAMPDB.
Referenced by Create().
|
protected |
Open the database.
Definition at line 122 of file creaImageIOTimestampDatabaseHandler.cpp.
References CppSQLite3Exception::errorCode(), CppSQLite3Exception::errorMessage(), GetFileName(), GimmickDebugMessage, GimmickError, GimmickMessage, mDB, and CppSQLite3DB::open().
Referenced by Open().
|
protected |
Definition at line 411 of file creaImageIOTimestampDatabaseHandler.cpp.
References UPDATETIMESTAMPDB.
Referenced by RemoveFile(), and RemoveNode().
bool creaImageIO::TimestampDatabaseHandler::Destroy | ( | ) |
Destroys the 'source'.
Definition at line 79 of file creaImageIOTimestampDatabaseHandler.cpp.
|
inline |
Returns the sqlite db file name.
Definition at line 53 of file creaImageIOTimestampDatabaseHandler.h.
Referenced by DBCreate(), and DBOpen().
std::string creaImageIO::TimestampDatabaseHandler::IsIndexed | ( | const std::string & | path, |
const std::string & | refdb | ||
) |
Returns the id of the path if it's indexed, blank otherwise.
Definition at line 297 of file creaImageIOTimestampDatabaseHandler.cpp.
References CleanPath(), CppSQLite3Query::eof(), CppSQLite3Query::getStringField(), CppSQLite3Query::nextRow(), CppSQLite3Query::numFields(), and QUERYTIMESTAMPDB.
Referenced by AddDirectory().
bool creaImageIO::TimestampDatabaseHandler::Open | ( | ) |
Opens an existing 'source'.
Definition at line 57 of file creaImageIOTimestampDatabaseHandler.cpp.
References DBOpen().
void creaImageIO::TimestampDatabaseHandler::RemoveEntries | ( | const std::string | i_table, |
const std::string | i_attribute, | ||
const std::string | i_operand, | ||
const std::string | i_val | ||
) |
Removes the entries that match the given parameters.
Definition at line 448 of file creaImageIOTimestampDatabaseHandler.cpp.
References UPDATETIMESTAMPDB.
void creaImageIO::TimestampDatabaseHandler::RemoveFile | ( | const std::string & | searchAtt, |
const std::string & | searchVal, | ||
const std::string & | refdb | ||
) |
Removes the filename with the given pathname.
Definition at line 369 of file creaImageIOTimestampDatabaseHandler.cpp.
References DBRemove(), CppSQLite3Query::eof(), CppSQLite3Query::getStringField(), CppSQLite3Query::nextRow(), CppSQLite3Query::numFields(), and QUERYTIMESTAMPDB.
Referenced by RemoveNode().
void creaImageIO::TimestampDatabaseHandler::RemoveNode | ( | const std::string & | searchAtt, |
const tree::Node * | node, | ||
const std::string & | refdb | ||
) |
Removes the given node.
Definition at line 345 of file creaImageIOTimestampDatabaseHandler.cpp.
References DBRemove(), creaImageIO::tree::Node::GetAttribute(), creaImageIO::tree::Node::GetChildrenList(), creaImageIO::tree::Node::GetLevel(), creaImageIO::tree::Node::GetNumberOfChildren(), and RemoveFile().
void creaImageIO::TimestampDatabaseHandler::SetAttribute | ( | const std::string & | attName, |
const std::string & | attValue, | ||
const std::string & | searchParam, | ||
const std::string & | searchValue | ||
) |
Sets the attribute to the value passed as parameter where the searchParameter is searchValue.
Definition at line 322 of file creaImageIOTimestampDatabaseHandler.cpp.
References CleanPath(), and UPDATETIMESTAMPDB.
Referenced by AddDirectory(), and CheckTimestamp().
|
private |
The DB.
Definition at line 126 of file creaImageIOTimestampDatabaseHandler.h.
Referenced by DBCreate(), DBOpen(), TimestampDatabaseHandler(), and ~TimestampDatabaseHandler().
|
private |
The physical location associated to the DicomDatabase (directory, db file...)
Definition at line 128 of file creaImageIOTimestampDatabaseHandler.h.