X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=src%2FcreaImageIOGimmick.cpp;h=47e5b4f19c6a6e0f854640950056e1fb2027385c;hb=1813f80def50d02057c58a83245739066f37f9f0;hp=1ec42e1fce32341d40eafd9a5e1dc4d21b1f8fb0;hpb=5ce273b1e5a79911e2582e16adc02f0c9505d5d2;p=creaImageIO.git diff --git a/src/creaImageIOGimmick.cpp b/src/creaImageIOGimmick.cpp index 1ec42e1..47e5b4f 100644 --- a/src/creaImageIOGimmick.cpp +++ b/src/creaImageIOGimmick.cpp @@ -52,10 +52,10 @@ namespace creaImageIO : mImageAdder(0) { RegisterGimmickMessageTypes(); - mSettings=0; - mSynchronizer=0; + mSettings = NULL; + mSynchronizer = NULL; mLocalDescpName = "localdatabase_Descriptor.dscp"; - mLocalDBName = "Local database"; + mLocalDBName = "Local database"; } //============================================================== @@ -63,13 +63,12 @@ namespace creaImageIO //============================================================== Gimmick::~Gimmick() { - - if(mSettings!=0) + if(mSettings!=NULL) { mSettings->writeSettingsFile(); delete mSettings; } - if(mSynchronizer!=0) + if(mSynchronizer!=NULL) { delete mSynchronizer; } @@ -79,8 +78,8 @@ namespace creaImageIO //============================================================== void Gimmick::Initialize(const std::string i_namedescp, const std::string i_namedb) { - mLocalDescpName = i_namedescp; - mLocalDBName = i_namedb; + mLocalDescpName = i_namedescp; + mLocalDBName = i_namedb; Initialize(); } @@ -92,22 +91,17 @@ namespace creaImageIO CreateUserSettingsDirectory(); // Sets the current directory to the home dir mCurrentDirectory = GetHomeDirectory(); - mSynchronizer= new Synchronizer(GetUserSettingsDirectory()+"share/creaImageIO/"); - + mSynchronizer= new Synchronizer( GetUserSettingsDirectory()+"share/creaImageIO/" ); mSettings = new Settings(mCurrentDirectory); - std::string dbpath = GetLocalDatabasePath(); - // Create or open local database std::string dpath= mCurrentDirectory + "/.creaImageIO/share/creaImageIO/" + mLocalDescpName; - boost::algorithm::replace_all( dpath, INVALID_FILE_SEPARATOR , VALID_FILE_SEPARATOR); mLocalDatabase = createDB(i_nameDB, dpath, dbpath); // Add it to the TreeHandlerMap mTreeHandlerMap[i_nameDB] = mLocalDatabase; - //Add additional DB from user Settings addDBSettings(); } @@ -156,9 +150,7 @@ namespace creaImageIO GimmickError("ERROR CREATING '"<SetAttribute(0,"Name",i_name); - } - else - { + } else { /// Open and test it GimmickDebugMessage(1,"Opening local database '" <second; - } - } + } // for + } // if } //============================================================== @@ -367,7 +359,6 @@ path+= mLocalDescpName; const std::vector& filenames) { GimmickMessage(2,"Adding files to '"<::iterator it = map_attr.begin(); for(; it != map_attr.end(); it++) + { i_res[it->first] = it->second; - } - else - { + } // for + } else { std::vector::iterator it = i_attr.inside.begin(); - for(; it != i_attr.inside.end(); it++) + for(; it != i_attr.inside.end(); it++) + { i_res[(*it)] = map_attr[(*it)]; - } - } + } // for + } // if ALL + } // if size } @@ -560,13 +551,13 @@ void Gimmick::fillVectInfos(std::vector i_attr, OutputAttr &infos) { if( mImageAdder.isAttributeExist((*it)) != "" ) // in DB { +printf("EED Gimmick::fillVectInfos inside %s\n",(*it).c_str()); infos.inside.push_back((*it)); - } - else - { + } else { infos.outside.push_back((*it)); // Need to scan again the files - } - } +printf("EED Gimmick::fillVectInfos outside %s\n",(*it).c_str()); + } // if + } // for } const std::string Gimmick::getSummary() @@ -580,4 +571,4 @@ const std::string Gimmick::getSummary() return mess.str(); } -} \ No newline at end of file +}