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

bool Impala::Application::WindowTrecSearch::SaveFinalResult (  )  [inline, private]

Definition at line 1053 of file mainTrecSearch.cpp.

References Impala::File::Close(), Impala::File::Fp(), Impala::Core::VideoSet::SegmentationDocument::GetBookmarked(), Impala::Core::Trec::SearchTopic::GetCurTopicNum(), Impala::Core::Trec::SearchTopic::GetElapsedTime(), Impala::Core::VideoSet::Segmentation::GetName(), Impala::Core::Trec::ThreadSet::GetThreadByName(), ILOG_ENDACTION, ILOG_ERROR, ILOG_INFO, ILOG_SYSTEM, mBackgroundColor, mSearchTopic, mSegDoc, mShots, mThreadSet, mTopicRunning, SetBg(), and Impala::File::Valid().

Referenced by RequestSaveFinalEvent().

01054     {
01055         ILOG_ENDACTION("topic");
01056         mTopicRunning = false;
01057         ILOG_SYSTEM("saving results for topic.");
01058         if (!mSearchTopic)
01059             return false;
01060         String curTopic = mSearchTopic->GetCurTopicNum();
01061         String fileName = String(".") + "/topic_" + curTopic + ".xml";
01062         String logfile = String(".") + "/log_" + curTopic + ".log";
01063         File f(fileName, "w");
01064         if (!f.Valid())
01065         {
01066             oglSys.ErrorBox("Error", "Unable to write result in current dir");
01067             return false;
01068         }
01069         fprintf(f.Fp(),"<videoSearchTopicResult tNum=\"%s\" ",curTopic.c_str());
01070         fprintf(f.Fp(),"elapsedTime=\"%.2f\" ",mSearchTopic->GetElapsedTime());
01071         fprintf(f.Fp(),"searcherId=\"user\">\n");
01072 
01073         Thread *result = mThreadSet->GetThreadByName("shots_finalresult");
01074         if (result == NULL)
01075         {
01076             ILOG_ERROR("final result set does not exist. Aborted save!");
01077             return false;
01078         }
01079         int first  = result->GetFirstShot();
01080         int length = result->GetLength();
01081         // For Cees' active learning comment line below
01082                 if (length > 1000) length = 1000; // max 1000 results.
01083 
01084         fprintf(f.Fp(), "<!-- nr selected images = %d -->\n",
01085                 mSegDoc->GetBookmarked()->Size());
01086         for (int i=0 ; i<length; i++)
01087         {
01088             String shot = mShots->GetName(result->GetShotAt(first, i));
01089             fprintf(f.Fp(), "<item seqNum=\"%d\" shotId=\"%s\"/>\n",
01090                     i+1, shot.c_str());
01091         }
01092         fprintf(f.Fp(), "</videoSearchTopicResult>\n\n");
01093         f.Close();
01094         SetBg(mBackgroundColor);
01095         ILOG_INFO("results for topic " << curTopic << " have been saved.");
01096         //ActionLogger::ClosePartLog(logfile);
01097         return true;
01098     }

Here is the call graph for this function:


Generated on Fri Mar 19 10:38:46 2010 for ImpalaSrc by  doxygen 1.5.1