Completed given DB_DIR in a "normal" walk.
Reimplemented from Impala::Core::ImageSet::Listener. Definition at line 212 of file InterestPointProc.h. References Impala::Persistency::RepositoryDispatcher< LocatorType, DataType, RepositoryInFileType, RepositoryInMonetType >::Add(), Impala::Core::Feature::FeatureTableResult::Delete(), Impala::Persistency::FeatureTableRepository::ExposeFilePath(), Impala::Core::Feature::FeatureTableResult::GetFeatureDefinition(), Impala::Core::Feature::InterestPointFeature::GetFeatureName(), Impala::Core::Feature::FeatureTableResult::GetTable(), Impala::Core::Feature::FeatureTableResult::GetTableSize(), Impala::GetTmpPath(), ILOG_INFO, ILOG_WARN, Impala::MakeString(), Impala::Core::Feature::InterestPointFeature::mClusterInput, Impala::Core::Feature::InterestPointFeature::mClusterInputData, mFeatureTableResult, mInterestPointFeature, mNoZIP, mSkipThisFolder, mTempFilenames, Impala::PathJoin(), Impala::Persistency::RepositoryGetFile(), Impala::Core::Feature::FeatureTableResult::Size(), and Impala::StringReplace(). 00213 { 00214 if (mSkipThisFolder) 00215 return; 00216 00217 FeatureLocator loc(is->GetLocator(), false, false, "", "empty", 00218 is->GetContainer(dirId)); 00219 // Feature table logic 00220 if (mFeatureTableResult.GetTableSize() != 0) 00221 { 00222 for(int i = 0; i < mFeatureTableResult.Size(); i++) 00223 { 00224 loc.SetFeatureDef(mFeatureTableResult.GetFeatureDefinition(i)); 00225 FeatureTableRepository().Add(loc, mFeatureTableResult.GetTable(i)); 00226 } 00227 mFeatureTableResult.Delete(); 00228 } 00229 00230 // ZIP-file logic 00231 if (!mNoZIP) 00232 { 00233 String featureName = mInterestPointFeature.GetFeatureName(); 00234 String fName = PathJoin(GetTmpPath(), "tmp-" + featureName + 00235 "-" + MakeString(dirId) + ".zip"); 00236 String txtName = StringReplace(fName, ".zip", ".txt"); 00237 loc.SetFeatureString(featureName + ".zip"); 00238 String serverName = FeatureTableRepository().ExposeFilePath(loc, 00239 true); 00240 serverName = StringReplace(serverName, ".zip.tab", ".tab.zip"); 00241 00242 // put it all in fName 00243 std::ofstream fs(txtName.c_str()); 00244 for (std::vector<String>::iterator iter = mTempFilenames.begin(); 00245 iter != mTempFilenames.end(); iter++) 00246 { 00247 fs << (*iter) << std::endl; 00248 } 00249 fs.close(); 00250 00251 String cmd = "zip "; 00252 cmd += fName; 00253 cmd += " -@ <"; 00254 cmd += txtName; 00255 //TODO: call toZip.py here? Instead of Shell scripting? 00256 if (!serverName.empty()) 00257 { 00258 // without override, fName will be empty if zip file already 00259 // exists, so we cannot ZIP! 00260 system(cmd.c_str()); 00261 } 00262 00263 // cleanup 00264 if (std::remove(txtName.c_str()) != 0) 00265 { 00266 ILOG_WARN("Could not cleanup intermediate file: " << txtName); 00267 } 00268 00269 // copy ZIP file to its final destination 00270 File srcFile = Persistency::RepositoryGetFile(fName, false, false); 00271 FileLocator dstLoc(is->GetLocator(), serverName); 00272 File dstFile = Persistency::RepositoryGetFile(dstLoc, true, false); 00273 dstFile.CopyFrom(srcFile); 00274 00275 // cleanup 00276 if (std::remove(fName.c_str()) != 0) 00277 { 00278 ILOG_WARN("Could not cleanup temporary ZIP file: " << fName); 00279 } 00280 } 00281 00282 // clusterInput mode 00283 if (mInterestPointFeature.mClusterInput && 00284 mInterestPointFeature.mClusterInputData) 00285 { 00286 loc.SetFeatureDef(mInterestPointFeature.mClusterInputData->GetFeatureDefinition()); 00287 FeatureTableRepository().Add(loc, mInterestPointFeature.mClusterInputData); 00288 delete mInterestPointFeature.mClusterInputData; 00289 mInterestPointFeature.mClusterInputData = 0; 00290 } 00291 00292 // cleanup 00293 for (std::vector<String>::iterator iter = mTempFilenames.begin(); 00294 iter != mTempFilenames.end(); iter++) 00295 { 00296 if (std::remove((*iter).c_str()) != 0) 00297 { 00298 ILOG_WARN("Could not cleanup intermediate file: " << (*iter)); 00299 } 00300 } 00301 mTempFilenames.clear(); 00302 ILOG_INFO("HandleDoneDir: " << dirId); 00303 }
Here is the call graph for this function:
|