#include #include #include #include namespace creaImageIO { //============================================================== Gimmick::Gimmick() : mImageAdder(0) { RegisterGimmickMessageTypes(); } //============================================================== //============================================================== Gimmick::~Gimmick() { } //============================================================== //============================================================== void Gimmick::Initialize() { // Create the UserSettings dir if does not exist CreateUserSettingsDirectory(); // Sets the current directory to the home dir mCurrentDirectory = GetHomeDirectory(); mSynchronizer=0; // Create local database handler mLocalDatabase = new SQLiteTreeHandler(GetLocalDatabasePath()); // Add it to the TreeHandlerMap mTreeHandlerMap["Local database"] = mLocalDatabase; // Create or open local database if (! boost::filesystem::exists( GetLocalDatabasePath() ) ) { std::string mess = "Local database '"; mess += GetLocalDatabasePath(); mess += "' does not exist : creating it"; GimmickMessage(1,mess<GetTree().GetDescriptor().CreateDefault(); if ( ! mLocalDatabase->Create(true) ) { GimmickError("ERROR CREATING '"<SetAttribute(0,"Name","Local database"); } else { /// Open and test it GimmickMessage(1,"Opening local database '" <Open(true) ) { GimmickError("ERROR OPENING '"<Create() ) { GimmickError("ERROR CREATING '"<Open() ) { GimmickError("ERROR OPENING '"<second; } //======================================================================== ///Returns the timestamp database handler TimestampDatabaseHandler* Gimmick::GetTimestampDatabase() const { return mTimestampDatabase; } //======================================================================== /// Add the files to the tree handler void Gimmick::AddFiles(const std::string& d, const std::vector& filenames) { GimmickMessage(2,"Adding files to '"<SetTreeHandler(handler); } mSynchronizer->Synchronize(update); } //======================================================================== /// void Gimmick::Print(const std::string& d) { GetTreeHandler(d)->GetTree().Print(); } //======================================================================== }