Home || Visual Search || Applications || Architecture || Important Messages || OGL || Src

virtual void Impala::Core::VideoSet::InterestPointProc::HandleDoneFile ( VideoSet vs,
int  fileId,
Stream::RgbDataSrc src 
) [inline, virtual]

Completed given DB_FILE in a "normal" walk.

Reimplemented from Impala::Core::VideoSet::Listener.

Definition at line 203 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, mSkipThisVideo, mTempFilenames, mWalkType, Impala::PathJoin(), Impala::Persistency::RepositoryGetFile(), Impala::Core::Feature::FeatureTableResult::Size(), and Impala::StringReplace().

00204     {
00205         if (mSkipThisVideo)
00206             return;
00207 
00208         FeatureLocator loc(vs->GetLocator(), false, false, mWalkType, "empty",
00209                            vs->GetContainer(fileId));
00210         // Feature table logic
00211         if (mFeatureTableResult.GetTableSize() != 0)
00212         {
00213             for(int i = 0; i < mFeatureTableResult.Size(); i++)
00214             {
00215                 loc.SetFeatureDef(mFeatureTableResult.GetFeatureDefinition(i));
00216                 FeatureTableRepository().Add(loc, mFeatureTableResult.GetTable(i));
00217             }
00218             mFeatureTableResult.Delete();
00219         }
00220         
00221         // ZIP-file logic
00222         if (!mNoZIP)
00223         {
00224             String featureName = mInterestPointFeature.GetFeatureName();
00225             String fName = PathJoin(GetTmpPath(), "tmp-" + featureName +
00226                                     "-" + MakeString(fileId) + ".zip");
00227             String txtName = StringReplace(fName, ".zip", ".txt");
00228             loc.SetFeatureString(featureName + ".zip");
00229             String serverName = FeatureTableRepository().ExposeFilePath(loc,
00230                                                                         true);
00231             serverName = StringReplace(serverName, ".zip.tab", ".tab.zip");
00232 
00233             // put it all in fName
00234             std::ofstream fs(txtName.c_str());
00235             for (std::vector<String>::iterator iter = mTempFilenames.begin();
00236                  iter != mTempFilenames.end(); iter++)
00237             {
00238                 fs << (*iter) << std::endl;
00239             }
00240             fs.close();
00241     
00242             String cmd = "zip ";
00243             cmd += fName;
00244             cmd += " -@ <";
00245             cmd += txtName;
00246             //TODO: call toZip.py here? Instead of Shell scripting?
00247             if (!serverName.empty())
00248             {
00249                 // without override, fName will be empty if zip file already
00250                 // exists, so we cannot ZIP!
00251                 system(cmd.c_str());
00252             }
00253             
00254             // cleanup
00255             if (std::remove(txtName.c_str()) != 0)
00256             {
00257                 ILOG_WARN("Could not cleanup intermediate file: " << txtName);
00258             }
00259             
00260             // copy ZIP file to its final destination
00261             File srcFile = Persistency::RepositoryGetFile(fName, false, false);
00262             FileLocator dstLoc(vs->GetLocator(), serverName);
00263             File dstFile = Persistency::RepositoryGetFile(dstLoc, true, false);
00264             dstFile.CopyFrom(srcFile);
00265 
00266             // cleanup
00267             if (std::remove(fName.c_str()) != 0)
00268             {
00269                 ILOG_WARN("Could not cleanup temporary ZIP file: " << fName);
00270             }
00271         }
00272 
00273         // clusterInput mode
00274         if (mInterestPointFeature.mClusterInput &&
00275             mInterestPointFeature.mClusterInputData)
00276         {
00277             loc.SetFeatureDef(mInterestPointFeature.mClusterInputData->GetFeatureDefinition());
00278             FeatureTableRepository().Add(loc, mInterestPointFeature.mClusterInputData);
00279             delete mInterestPointFeature.mClusterInputData;
00280             mInterestPointFeature.mClusterInputData = 0;
00281         }
00282         
00283         // cleanup
00284         for (std::vector<String>::iterator iter = mTempFilenames.begin();
00285              iter != mTempFilenames.end(); iter++)
00286         {
00287             if (std::remove((*iter).c_str()) != 0)
00288             {
00289                 ILOG_WARN("Could not cleanup intermediate file: " << (*iter));
00290             }
00291         }
00292         mTempFilenames.clear();
00293         ILOG_INFO("HandleDoneFile: " << fileId);
00294     }

Here is the call graph for this function:


Generated on Thu Jan 13 09:21:59 2011 for ImpalaSrc by  doxygen 1.5.1